Bookings API
The Staffmap API allows you to do the following with Booking records:
GET
Get All Bookings | Authenticated
Syntax:
GET {Domain}/staffmap4/{ProjectName}/api/Booking
e.g.
GET http://localhost/staffmap4/ProjectName/api/Booking
GET https://acme.com/staffmap4/MainOffice/api/Booking
Get All Bookings | URL
Syntax:
{Domain}/staffmap4/{ProjectName}/api/Booking?apikey={APIKey}
e.g.
http://localhost/staffmap4/ProjectName/api/Booking?apikey=aP2bjYAeeYrUx0hPYQ
https://acme.com/staffmap4/MainOffice/api/Booking?apikey=l4MZnM2Y58lwVgubQn
Get One Booking | Authenticated
Syntax:
GET {Domain}/staffmap4/{ProjectName}/api/Booking/{id}
e.g.
GET http://localhost/staffmap4/ProjectName/api/Booking/20191104110235817
GET https://acme.com/staffmap4/MainOffice/api/Booking/20180921194845701
Get One Booking | URL
Syntax:
{Domain}/staffmap4/{ProjectName}/api/Booking/{id}?apikey={APIKey}
e.g.
http://localhost/staffmap4/ProjectName/api/Booking/20180921194845701?apikey=aP2bjYAeeYrUx0hPYQ
Result (two records)
[
{
"starttime": "2020-09-15",
"endtime": "2020-09-15 11:59:00 PM",
"description": "",
"desk_id": "20200904153511852",
"createdby": "admin",
"employee_id": "201504211036158606",
"booking_id": "20200904153515209",
"category": "",
"title": "",
"bookingtype": "recurrence",
"recurrence": "Tu,Fr"
},
{
"starttime": "2020-09-11",
"endtime": "2020-09-11 11:59:00 PM",
"description": "",
"desk_id": "20200204163504742",
"createdby": "admin",
"employee_id": "201506030359164580",
"booking_id": "20200904153331688",
"category": "Desk",
"title": "",
"bookingtype": "",
"recurrence": ""
},
]
POST (create)
When creating a new record, the unique booking ID will be automatically created and does not need to be included as parameter.
POST | Authenticated
Syntax:
POST {Domain}/staffmap4/{ProjectName}/api/Booking/?{parameter1:value1}&{parameter2}:{value2}...
e.g.
POST http://localhost/staffmap4/BookingTest/api/Booking?starttime=2020-09-15&endtime=2020-09-15 11:59:00 PM&desk_id=20200204163504742&employee_id=201412100308382148
http://localhost/staffmap4/BookingTest/api/Booking?starttime=2020-09-22&endtime=2020-09-15 11:59:00 PM&desk_id=201504301032193358&employee_id=201412100308382148&recurrence=Tu,Fr
Result
[
{
"id": "2020020726122423"
},
{
"status": "Booking record successfully added"
}
]
PUT (update)
PUT | Authenticated
Syntax:
PUT {Domain}/staffmap4/{ProjectName}/api/Booking/{id}?{parameter1:value1}&{parameter2:value2}...
e.g.
PUT http://localhost/staffmap4/ProjectName/api/Booking/2020020679547848?starttime=2020-08-07
PUT https://acme.com/staffmap4/MainOffice/api/Booking/2020020619325472?employee_id=2018928791
Result
[
{
"status": "Booking record successfully updated"
}
]
DELETE
Delete | Authenticated
Syntax:
DELETE {Domain}/staffmap4/{ProjectName}/api/Booking/{id}
e.g.
DELETE http://localhost/staffmap4/ProjectName/api/Booking/201711300130174407
DELETE https://acme.com/staffmap4/MainOffice/api/Booking/2020020630313932
Result
[
{
"status": "Booking record successfully deleted"
}
]