Assets API

The Staffmap API allows you to do the following with Asset records:

GET

Get All Assets | Authenticated

Syntax:

GET {Domain}/staffmap4/{ProjectName}/api/Asset

e.g.

GET http://localhost/staffmap4/ProjectName/api/Asset
GET https://acme.com/staffmap4/MainOffice/api/Asset


Get All Assets | URL

Syntax:

{Domain}/staffmap4/{ProjectName}/api/Asset?apikey={APIKey}

e.g.

http://localhost/staffmap4/ProjectName/api/Asset?apikey=aP2bjYAeeYrUx0hPYQ 
https://acme.com/staffmap4/MainOffice/api/Asset?apikey=l4MZnM2Y58lwVgubQn


Get One Asset | Authenticated

Syntax:

GET {Domain}/staffmap4/{ProjectName}/api/Asset/{id}

e.g.

GET http://localhost/staffmap4/ProjectName/api/Asset/20191104110235817
GET https://acme.com/staffmap4/MainOffice/api/Asset/20180921194845701


Get One Asset | URL

Syntax:

{Domain}/staffmap4/{ProjectName}/api/Asset/{id}?apikey={APIKey}

e.g.

http://localhost/staffmap4/ProjectName/api/Asset/6lnnh96x6hj0?apikey=aP2bjYAeeYrUx0hPYQ 


Result (two records)

[
     {
        "asset_id": "20180921201109366",
        "floor_id": "4",
        "name": "Printer 12",
        "category": "Printer",
        "top": "1392",
        "left": "613",
        "width": "-1",
        "height": "-1",
        "make": "Canon",
        "model": "",
        "serial number": "77756565",
        "date purchased": "2018-12-06",
        "phone number": "",
        "conferencing": "False",
        "voicemail": "False",
        "copier": "False",
        "employee_id": "",
        "picalign": "",
        "customclickurl": "",
        "key": "",
        "latitude": "",
        "longitude": ""
    },
    {
        "asset_id": "2018092217102034",
        "floor_id": "4",
        "name": "Projector 01",
        "category": "Projector",
        "top": "96",
        "left": "2489",
        "width": "-1",
        "height": "-1",
        "make": "Benq",
        "model": "",
        "serial number": "67867444",
        "date purchased": "2018-09-24 10:16:13 AM",
        "phone number": "",
        "conferencing": "False",
        "voicemail": "False",
        "copier": "False",
        "employee_id": "",
        "picalign": "",
        "customclickurl": "",
        "key": "",
        "latitude": "",
        "longitude": ""
    }
]

POST (create)

When creating a new record, the unique asset ID will be automatically created and does not need to be included as parameter.

POST | Authenticated

Syntax:

POST {Domain}/staffmap4/{ProjectName}/api/Asset/?{parameter1:value1}&{parameter2}:{value2}...

e.g.

POST http://localhost/staffmap4/ProjectName/api/Asset/?name=Printer17&Manufacturer=Canon
POST https://acme.com/staffmap4/ProjectName/api/Asset/?name=Microwave&category=Kitchen&size=medium

Result

[
    {
        "id": "2020020726122423"
    },
    {
        "status": "Asset record successfully added"
    }
]

PUT (update)

PUT | Authenticated

Syntax:

PUT {Domain}/staffmap4/{ProjectName}/api/Asset/{id}?{parameter1:value1}&{parameter2:value2}...

e.g.

PUT http://localhost/staffmap4/ProjectName/api/Asset/2020020679547848?status=broken&dateupdated=2020-02-07
PUT https://acme.com/staffmap4/MainOffice/api/Asset/2020020619325472?employee_id=2018928791&name=Personal Printer

Result

[
    {
        "status": "Asset record successfully updated"
    }
]

DELETE

Delete | Authenticated

Syntax:

DELETE {Domain}/staffmap4/{ProjectName}/api/Asset/{id}

e.g.

DELETE http://localhost/staffmap4/ProjectName/api/Asset/201711300130174407
DELETE https://acme.com/staffmap4/MainOffice/api/Asset/2020020630313932

Result

[
    {
        "status": "Asset record successfully deleted"
    }
]