As mentioned before each API call must be authorized by a valid authorization token. To get the valid authorization token you must authenticate user first.
Booking confirmation code
By default the booking confirmation code is a random and unique 6-chars code (i.e. 7HD493, BABTGJ, GZ5B7S, LYRAEV) generated for you while creating a new booking.
The confirmation code works exactly in the same way as in the airline and travel industries where a passenger name record (PNR) is a record in the database of a computer reservation system (CRS) that consists of the personal information for a passenger and also contains the itinerary for the passenger. Here, a passenger is a visitor.
However, if you would like to provide your own custom confirmation code for a booking you are free to do so. Remember, the code must be unique across the system. Otherwise you will likely get a uniqueness validation error.
Get list of active bookings
# Get active bookings
$ http GET https://secure.yardman.io/api/bookings \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Thu, 22 Mar 2018 06:40:16 GMT
ETag: W/"75bf268dd78edc537205d662e0088470"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 1fe64eb5-d08a-4bde-8c11-869d6818ad36
X-Runtime: 0.023794
X-XSS-Protection: 1; mode=block
[
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 28,
"name": "Ward, Nitzsche and O'Conner",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-03-21T07:30:00.000Z",
"confirmation_code": "HO5XZI",
"id": 91,
"movement_plan": {
"id": 34,
"name": "Suppliers",
"yard": {
"id": 25,
"name": "Hane Court"
}
},
"notes": "",
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
},
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 45,
"name": "Renner LLC",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-03-21T08:30:00.000Z",
"confirmation_code": "K8Z2FU",
"id": 92,
"movement_plan": {
"id": 34,
"name": "Suppliers",
"yard": {
"id": 25,
"name": "Hane Court"
}
},
"notes": "",
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
},
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 61,
"name": "Olson LLC",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-03-21T09:00:00.000Z",
"confirmation_code": "USASWU",
"id": 93,
"movement_plan": {
"id": 34,
"name": "Suppliers",
"yard": {
"id": 25,
"name": "Hane Court"
}
},
"notes": "",
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
}
]
Result filtering
Simple result filtering is implemented as query parameter q
on top of the base
URL. You may filter (search) by booking confirmation code or bookable
name.
Please note, you may mix’n’match filtering parameter along with pagination parameters to get desired results.
# Find bookings with XQSFN confirmation code (mind the q param)
$ http GET https://secure.yardman.io/api/bookings \
> q==XQSFN \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"
or
# Find bookings with Wintheiser as a part of bookable name (mind the q param)
$ http GET https://secure.yardman.io/api/bookings \
> q==Wintheiser \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Nov 2018 15:07:15 GMT
ETag: W/"d486b14de20895c662eb9f9d10543e59"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: a199a789-a367-49e8-bebc-fdd2a072228f
X-Runtime: 0.016309
X-XSS-Protection: 1; mode=block
[
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 25,
"name": "Wintheiser Group",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-04-27T11:45:00.000Z",
"confirmation_code": "XQSFN",
"id": 105,
"movement_plan": null,
"notes": null,
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
}
]
Create new booking
To create new booking you have to provide all related and existing in the system objects’ ids needed for the booking. You may create booking for either a company or a person.
# Create new booking for a company
$ http POST https://secure.yardman.io/api/bookings \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> bookable_type=Company \
> bookable_id=25 \
> yard_id=25 \
> movement_plan_id=36 \
> check_in_at="2018-04-27T11:45:00.000Z"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 201 Created
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Thu, 22 Mar 2018 06:48:46 GMT
ETag: W/"11856525be751ee2fe315eb392034c69"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 8516edc0-d507-402b-ac8f-b8e2dd8cd8dd
X-Runtime: 0.047772
X-XSS-Protection: 1; mode=block
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 25,
"name": "Wintheiser Group",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-04-27T11:45:00.000Z",
"confirmation_code": "Z6M703",
"id": 106,
"movement_plan": {
"id": 36,
"name": "Others 2h",
"yard": {
"id": 25,
"name": "Hane Court"
}
},
"notes": null,
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
}
Show booking data
To show the booking data you have to provide its id
value.
# Show booking no. 105
$ http GET https://secure.yardman.io/api/bookings/105 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Nov 2018 11:56:58 GMT
ETag: W/"726169f40810646f3c59907a17eed12e"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 2fbc38a1-3afa-4117-a41c-4a442c233c57
X-Runtime: 0.012061
X-XSS-Protection: 1; mode=block
{
"active": true,
"bookable": {
"company": {
"email": null,
"id": 25,
"name": "Wintheiser Group",
"notes": null
},
"type": "company"
},
"check_in_at": "2018-04-27T11:45:00.000Z",
"confirmation_code": "XQSFN",
"id": 105,
"movement_plan": null,
"notes": null,
"yard": {
"id": 25,
"location": {
"id": 19,
"name": "Emmerichfort"
},
"name": "Hane Court"
}
}
Update booking data
To update the booking data you have to provide its id
value and data to be
updated.
# Update recently added booking
$ http PUT https://secure.yardman.io/api/bookings/105 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> check_in_at="2018-04-27T12:00:00.000Z"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 204 No Content
Cache-Control: no-cache
Connection: keep-alive
Date: Thu, 22 Mar 2018 06:46:31 GMT
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 61bf919e-d44c-4798-a2a4-e1c39e5e55e8
X-Runtime: 0.039818
X-XSS-Protection: 1; mode=block
Delete existing booking
To delete a booking you have to provide its id
value. You may obtain one from
the active bookings list described above.
# Delete recently updated booking
$ http DELETE https://secure.yardman.io/api/bookings/105 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg"
If the authorization token is valid you should get something similar to the following result:
HTTP/1.1 204 No Content
Cache-Control: no-cache
Connection: keep-alive
Date: Wed, 23 May 2018 12:15:05 GMT
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 6aceed0d-e4fa-4566-8a56-2d70522544b3
X-Runtime: 0.039818
X-XSS-Protection: 1; mode=block