Visits API methods

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.

Get list of visits

# Get all visits
$ http GET https://secure.yardman.io/api/visits \
> 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: Wed, 21 Mar 2018 18:20:35 GMT
ETag: W/"dbd38502727b4fa2d831e6f287155771"
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: 1689334e-b75a-4f9e-8870-c6e3872f210a
X-Runtime: 0.162186
X-XSS-Protection: 1; mode=block

[
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T15:01:27.649Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T15:07:00.248Z",
                "id": 135,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:01:27.649Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T15:07:00.248Z",
                "id": 136,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T15:22:26.911Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T15:28:54.944Z",
                "id": 137,
                "place": {
                    "id": 163,
                    "name": "Dock A12"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:22:26.911Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T15:28:54.944Z",
                "id": 138,
                "place": {
                    "id": 163,
                    "name": "Dock A12"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T15:41:42.495Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T15:49:37.216Z",
                "id": 139,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:41:42.495Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T15:49:37.216Z",
                "id": 140,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-20T15:02:00.000Z",
            "id": 83,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 25,
            "name": "Wintheiser Group",
            "notes": null
        },
        "created_at": "2018-03-20T15:01:01.057Z",
        "id": 72,
        "movement_plan": {
    "checkpoints:" [{
        "area": {
            "id": 99,
        "name": "Entry Gate"
        },
        "estimated_arrival_in": 300,
        "estimated_departure_in": 900,
        "id": 128
    }, {
    
        "area": {
            "id": 99,
        "name": "Entry Gate"
        },
        "estimated_arrival_in": 300,
        "estimated_departure_in": 900,
        "id": 128
    }]
    "id": 34,
            "name": "Suppliers",
            "yard": {
                "id": 25,
                "name": "Hane Court"
            },
    "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Schuyler",
            "id": 52,
            "last_name": "Swift",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T15:49:37.274Z",
        "vehicle": {
            "brand": "Toyota",
            "id": 158,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
            "id": 29,
            "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T16:17:14.173Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T16:19:08.161Z",
                "id": 141,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 185,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T16:17:14.173Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T16:19:08.161Z",
                "id": 142,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 63,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T16:21:41.939Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T16:24:56.100Z",
                "id": 143,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 185,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T16:21:41.939Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T16:24:56.100Z",
                "id": 144,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 63,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Person",
            "check_in_at": "2018-03-20T16:05:00.000Z",
            "id": 85,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 37,
            "name": "Wisozk, McCullough and Gerlach",
            "notes": null
        },
        "created_at": "2018-03-20T15:52:46.254Z",
        "id": 73,
        "movement_plan": {
    "checkpoints:" [{
        "area": {
            "id": 99,
        "name": "Entry Gate"
        },
        "estimated_arrival_in": 300,
        "estimated_departure_in": 900,
        "id": 128
    }, {
    
        "area": {
            "id": 99,
        "name": "Entry Gate"
        },
        "estimated_arrival_in": 300,
        "estimated_departure_in": 900,
        "id": 128
    }]
    "id": 34,
            "name": "Suppliers",
            "yard": {
                "id": 25,
                "name": "Hane Court"
            },
    "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Isaiah",
            "id": 63,
            "last_name": "Gerhold",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T16:24:56.164Z",
        "vehicle": {
            "brand": "DAF",
            "id": 185,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null 
    }
]

Result filtering & sorting

Complex result filters and sorting requirements are implemented as query parameters on top of the base URL.

Filtering by dates

We use unique query parameters before and after that implements filtering by date ranges. For example, when requesting a list of visits from the /api/visits endpoint, you may want to limit these to only those created before and/or after certain point of time. This could be accomplished with a request like GET /api/visits?after=2018-03-01&before=2018-03-31. Here, before and after are query parameters that implement a date range filter. To get visits older than certain point of time you may use just the before parameter. By using just the after parameter you will get the opposite result.

Let’s get visits in time frame window from 20th to 21st of March 2018.

# Get list of visits in specified time frame window (mind the date params)
$ http GET https://secure.yardman.io/api/visits \
> after==2018-03-20 before==2018-03-22 \
> 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: Tue, 27 Mar 2018 05:51:09 GMT
ETag: W/"6a03a87de369c95c771e4b5f9cad3abd"
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: d4c3e5e4-55ef-4829-a298-d695a19ffae8
X-Runtime: 0.187475
X-XSS-Protection: 1; mode=block

[
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T15:01:27.649Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T15:07:00.248Z",
                "id": 135,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:01:27.649Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T15:07:00.248Z",
                "id": 136,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T15:22:26.911Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T15:28:54.944Z",
                "id": 137,
                "place": {
                    "id": 163,
                    "name": "Dock A12"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:22:26.911Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T15:28:54.944Z",
                "id": 138,
                "place": {
                    "id": 163,
                    "name": "Dock A12"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T15:41:42.495Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T15:49:37.216Z",
                "id": 139,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 158,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T15:41:42.495Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T15:49:37.216Z",
                "id": 140,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 52,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-20T15:02:00.000Z",
            "id": 83,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 25,
            "name": "Wintheiser Group",
            "notes": null
        },
        "created_at": "2018-03-20T15:01:01.057Z",
        "id": 72,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Schuyler",
            "id": 52,
            "last_name": "Swift",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T15:49:37.274Z",
        "vehicle": {
            "brand": "Toyota",
            "id": 158,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T16:17:14.173Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T16:19:08.161Z",
                "id": 141,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 185,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T16:17:14.173Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T16:19:08.161Z",
                "id": 142,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 63,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T16:21:41.939Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T16:24:56.100Z",
                "id": 143,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 185,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T16:21:41.939Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T16:24:56.100Z",
                "id": 144,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 63,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Person",
            "check_in_at": "2018-03-20T16:05:00.000Z",
            "id": 85,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 37,
            "name": "Wisozk, McCullough and Gerlach",
            "notes": null
        },
        "created_at": "2018-03-20T15:52:46.254Z",
        "id": 73,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Isaiah",
            "id": 63,
            "last_name": "Gerhold",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T16:24:56.164Z",
        "vehicle": {
            "brand": "DAF",
            "id": 185,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    # ... cropped for clarity ...
    {
        "asset_positions": [],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T18:27:00.000Z",
            "id": 104,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 30,
            "name": "O'Hara, Doyle and Strosin",
            "notes": null
        },
        "created_at": "2018-03-21T18:25:19.665Z",
        "id": 82,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Carmine",
            "id": 57,
            "last_name": "Steuber",
            "mobile_phone": null,
            "notes": null,
            "status": "waiting"
        },
        "status": "planned",
        "updated_at": "2018-03-21T18:25:19.665Z",
        "vehicle": {
            "brand": "Mercedes-Benz",
            "id": 160,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    }
]
Filtering by status

We use a unique query parameter status that implements filtering. For example, when requesting a list of visits from the /api/visits endpoint, you may want to limit these to only those in the planned state. This could be accomplished with a request like GET /api/visits?status=planned. Here, status is a query parameter that implements a filter.

Valid values for status filter are:

  • planned
  • in_progress
  • finished

Let’s get just planned visits.

# Get list of planned visits (mind the status param)
$ http GET https://secure.yardman.io/api/visits status==planned \
> 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: Wed, 21 Mar 2018 18:25:25 GMT
ETag: W/"bd492bed70b50250bad8d0217e08bf38"
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: ab16104e-80f7-4743-b215-ba172349d8d9
X-Runtime: 0.026248
X-XSS-Protection: 1; mode=block

[
    {
        "asset_positions": [],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T08:00:00.000+01:00",
            "id": 90,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 65,
            "name": "O'Hara, Hirthe and Kub",
            "notes": null
        },
        "created_at": "2018-03-21T19:24:35.291+01:00",
        "id": 81,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Uriah",
            "id": 54,
            "last_name": "Schmeler",
            "mobile_phone": null,
            "notes": null,
            "status": "waiting"
        },
        "status": "planned",
        "updated_at": "2018-03-21T19:24:35.291+01:00",
        "vehicle": {
            "brand": "Jeep",
            "id": 162,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T19:27:00.000+01:00",
            "id": 104,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 30,
            "name": "O'Hara, Doyle and Strosin",
            "notes": null
        },
        "created_at": "2018-03-21T19:25:19.665+01:00",
        "id": 82,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Carmine",
            "id": 57,
            "last_name": "Steuber",
            "mobile_phone": null,
            "notes": null,
            "status": "waiting"
        },
        "status": "planned",
        "updated_at": "2018-03-21T19:25:19.665+01:00",
        "vehicle": {
            "brand": "Mercedes-Benz",
            "id": 160,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        }, 
        "properties": null
    }
]
Sorting

Similar to filtering, a generic parameter sort can be used to describe sorting rules. Accommodate complex sorting requirements by providing list of comma separated fields, each with a possible unary negative to imply descending sort order.

Let’s look at some examples.

Request like GET /api/visits?sort=-created_at retrieves a list of visits in descending order of creation.

Whereas request like GET /api/visits?sort=-updated_at,created_at retrieves a list of visits in descending order of update. Within a specific update time gap, older visits are ordered first.

Valid values for sort parameter are:

  • created_at
  • -created_at
  • updated_at
  • -updated_at

Please note, you may mix’n’match filtering and sorting parameters along with pagination parameters to get desired results.

# Get list of recently updated visits (mind the sort param)
$ http GET https://secure.yardman.io/api/visits sort==-updated_at \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg"
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 21 Mar 2018 18:26:24 GMT
ETag: W/"8879bd19dc1b912de559b84d04c367b2"
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: e71973ee-fdba-42ee-ab90-e8faab947e8f
X-Runtime: 0.180137
X-XSS-Protection: 1; mode=block

[
    {
        "asset_positions": [],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T18:27:00.000Z",
            "id": 104,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 30,
            "name": "O'Hara, Doyle and Strosin",
            "notes": null
        },
        "created_at": "2018-03-21T18:25:19.665Z",
        "id": 82,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Carmine",
            "id": 57,
            "last_name": "Steuber",
            "mobile_phone": null,
            "notes": null,
            "status": "waiting"
        },
        "status": "planned",
        "updated_at": "2018-03-21T18:25:19.665Z",
        "vehicle": {
            "brand": "Mercedes-Benz",
            "id": 160,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        }, 
    "properties": null
    },
    {
        "asset_positions": [],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T07:00:00.000Z",
            "id": 90,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 65,
            "name": "O'Hara, Hirthe and Kub",
            "notes": null
        },
        "created_at": "2018-03-21T18:24:35.291Z",
        "id": 81,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Uriah",
            "id": 54,
            "last_name": "Schmeler",
            "mobile_phone": null,
            "notes": null,
            "status": "waiting"
        },
        "status": "planned",
        "updated_at": "2018-03-21T18:24:35.291Z",
        "vehicle": {
            "brand": "Jeep",
            "id": 162,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-21T06:46:12.214Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-21T06:47:44.217Z",
                "id": 171,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 169,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-21T06:46:12.214Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-21T06:47:44.217Z",
                "id": 172,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 85,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-21T08:47:34.602Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-21T08:48:03.276Z",
                "id": 173,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 169,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-21T08:47:34.602Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-21T08:48:03.276Z",
                "id": 174,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 85,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-21T06:45:00.000Z",
            "id": 94,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 49,
            "name": "Will LLC",
            "notes": null
        },
        "created_at": "2018-03-21T06:45:40.519Z",
        "id": 79,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Alberto",
            "id": 85,
            "last_name": "O'Reilly",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-21T08:48:03.337Z",
        "vehicle": {
            "brand": "Renault",
            "id": 169,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T17:58:24.573Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 101
                },
                "departed_at": "2018-03-20T18:11:44.517Z",
                "id": 153,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 252,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T17:58:24.573Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 101
                },
                "departed_at": "2018-03-20T18:11:44.517Z",
                "id": 154,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 135,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T18:19:28.930Z",
                "checkpoint": {
                    "area": {
                        "id": 57,
                        "name": "Warehouse A2"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 1800,
                    "id": 102
                },
                "departed_at": "2018-03-20T18:47:26.135Z",
                "id": 157,
                "place": {
                    "id": 165,
                    "name": "Dock A21"
                },
                "positionable_id": 252,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T18:19:28.930Z",
                "checkpoint": {
                    "area": {
                        "id": 57,
                        "name": "Warehouse A2"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 1800,
                    "id": 102
                },
                "departed_at": "2018-03-20T18:47:26.135Z",
                "id": 158,
                "place": {
                    "id": 165,
                    "name": "Dock A21"
                },
                "positionable_id": 135,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T18:57:24.687Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 3600,
                    "id": 103
                },
                "departed_at": "2018-03-20T19:41:25.341Z",
                "id": 163,
                "place": {
                    "id": 164,
                    "name": "Dock A13"
                },
                "positionable_id": 252,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T18:57:24.687Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 3600,
                    "id": 103
                },
                "departed_at": "2018-03-20T19:41:25.341Z",
                "id": 164,
                "place": {
                    "id": 164,
                    "name": "Dock A13"
                },
                "positionable_id": 135,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T20:14:43.884Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 104
                },
                "departed_at": "2018-03-20T20:20:01.215Z",
                "id": 169,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 252,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T20:14:43.884Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 104
                },
                "departed_at": "2018-03-20T20:20:01.215Z",
                "id": 170,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 135,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-20T17:58:00.000Z",
            "id": 89,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 66,
            "name": "Doyle LLC",
            "notes": null
        },
        "created_at": "2018-03-20T17:53:16.430Z",
        "id": 77,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Francis",
            "id": 135,
            "last_name": "Simonis",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T20:20:01.276Z",
        "vehicle": {
            "brand": "Ford",
            "id": 252,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T17:46:33.490Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T17:47:42.428Z",
                "id": 147,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 163,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T17:46:33.490Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 105
                },
                "departed_at": "2018-03-20T17:47:42.428Z",
                "id": 148,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 139,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T19:41:42.621Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T19:44:15.772Z",
                "id": 167,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 163,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T19:41:42.621Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 7200,
                    "estimated_departure_in": 300,
                    "id": 106
                },
                "departed_at": "2018-03-20T19:44:15.772Z",
                "id": 168,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 139,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-20T16:30:00.000Z",
            "id": 86,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 71,
            "name": "Cole Group",
            "notes": null
        },
        "created_at": "2018-03-20T16:25:50.177Z",
        "id": 75,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Lora",
            "id": 139,
            "last_name": "Okuneva",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T19:44:15.832Z",
        "vehicle": {
            "brand": "Mercedes-Benz",
            "id": 163,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    {
        "asset_positions": [
            {
                "arrived_at": "2018-03-20T18:12:18.197Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T18:17:16.691Z",
                "id": 155,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 231,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T18:12:18.197Z",
                "checkpoint": {
                    "area": {
                        "id": 55,
                        "name": "Entry Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 98
                },
                "departed_at": "2018-03-20T18:17:16.691Z",
                "id": 156,
                "place": {
                    "id": 161,
                    "name": "Entrance"
                },
                "positionable_id": 148,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T18:26:17.835Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T19:12:56.712Z",
                "id": 159,
                "place": {
                    "id": 162,
                    "name": "Dock A11"
                },
                "positionable_id": 231,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T18:26:17.835Z",
                "checkpoint": {
                    "area": {
                        "id": 56,
                        "name": "Warehouse A1"
                    },
                    "estimated_arrival_in": 300,
                    "estimated_departure_in": 3600,
                    "id": 99
                },
                "departed_at": "2018-03-20T19:12:56.712Z",
                "id": 160,
                "place": {
                    "id": 162,
                    "name": "Dock A11"
                },
                "positionable_id": 148,
                "positionable_type": "Person"
            },
            {
                "arrived_at": "2018-03-20T19:20:38.061Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T19:41:08.680Z",
                "id": 165,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 231,
                "positionable_type": "Vehicle"
            },
            {
                "arrived_at": "2018-03-20T19:20:38.061Z",
                "checkpoint": {
                    "area": {
                        "id": 58,
                        "name": "Exit Gate"
                    },
                    "estimated_arrival_in": 900,
                    "estimated_departure_in": 300,
                    "id": 100
                },
                "departed_at": "2018-03-20T19:41:08.680Z",
                "id": 166,
                "place": {
                    "id": 168,
                    "name": "Exit"
                },
                "positionable_id": 148,
                "positionable_type": "Person"
            }
        ],
        "booking": {
            "bookable_type": "Company",
            "check_in_at": "2018-03-20T17:54:00.000Z",
            "id": 88,
            "notes": ""
        },
        "company": {
            "email": null,
            "id": 59,
            "name": "Turcotte, Lueilwitz and Gislason",
            "notes": null
        },
        "created_at": "2018-03-20T17:53:29.489Z",
        "id": 78,
        "movement_plan": {
        "checkpoints:" [{
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }, {
        
            "area": {
                "id": 99,
            "name": "Entry Gate"
            },
            "estimated_arrival_in": 300,
            "estimated_departure_in": 900,
            "id": 128
        }]
        "id": 34,
                "name": "Suppliers",
                "yard": {
                    "id": 25,
                    "name": "Hane Court"
                },
        "properties": null
        },
        "notes": "",
        "person": {
            "driving_license_number": null,
            "email": null,
            "first_name": "Otha",
            "id": 148,
            "last_name": "Green",
            "mobile_phone": null,
            "notes": null,
            "status": "unknown"
        },
        "status": "finished",
        "updated_at": "2018-03-20T19:41:08.741Z",
        "vehicle": {
            "brand": "Opel",
            "id": 231,
            "model": null,
            "properties": null,
            "registration_number": "MG34023",
            "status": "parked",
            "vehicle_type": {
                "id": 29,
                "name": "Karton Uniwersalny"
            }
        },
        "properties": null
    },
    # ... cropped for clarity ...
]

Create a new visit

To create a new visit you need to provide all related and existing in the system object’s ids needed for a visit.

# Create a new visit
$ http POST https://secure.yardman.io/api/visits \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> person_id=138 \
> company_id=25 \
> vehicle_id=166 \
> movement_plan_id=35 \
> booking_id=1360

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: Wed, 25 Nov 2020 15:57:08 GMT
ETag: W/"de4cdfb7ff1e7b30c8a49c347e4f0a83"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=15552000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 504a4209-d89b-48ea-9a0b-7d3a7702d443
X-Runtime: 0.113576
X-XSS-Protection: 1; mode=block

{
    "asset_positions": [],
    "booking": {
        "bookable_type": "Person",
        "check_in_at": "2021-01-15T20:09:00.000Z",
        "id": 1360,
        "notes": ""
    },
    "company": {
        "email": null,
        "id": 25,
        "name": "Wintheiser Group",
        "notes": null
    },
    "created_at": "2021-01-14T20:13:57.095Z",
    "id": 855,
    "movement_plan": {
        "checkpoints": [
            {
                "area": {
                    "id": 55,
                    "name": "Entry Gate"
                },
                "estimated_arrival_in": 900,
                "estimated_departure_in": 300,
                "id": 101
            },
            {
                "area": {
                    "id": 57,
                    "name": "Warehouse A2"
                },
                "estimated_arrival_in": 900,
                "estimated_departure_in": 1800,
                "id": 102
            },
            {
                "area": {
                    "id": 56,
                    "name": "Warehouse A1"
                },
                "estimated_arrival_in": 900,
                "estimated_departure_in": 3600,
                "id": 103
            },
            {
                "area": {
                    "id": 58,
                    "name": "Exit Gate"
                },
                "estimated_arrival_in": 900,
                "estimated_departure_in": 300,
                "id": 104
            }
        ],
        "id": 35,
        "name": "Traders",
        "properties": null,
        "yard": {
            "id": 25,
            "name": "Hane Court"
    }
    },
    "notes": null,
    "person": {
        "driving_license_number": "DJAS244",
        "email": null,
        "first_name": "Edmund",
        "id": 138,
        "last_name": "Reichert",
        "mobile_phone": "+48600100100",
        "notes": null,
        "status": "waiting"
    },
    "person_called": false,
    "properties": null,
    "status": "planned",
    "updated_at": "2021-01-14T20:13:57.095Z",
    "vehicle": {
        "brand": "Isuzu",
        "id": 166,
        "model": null,
        "properties": null,
        "registration_number": "HC94612",
        "status": "parked",
        "vehicle_type": {
            "id": 19,
            "name": "Truck"
        }
    }
}

Send text message to a person (optional)

This method is allowed for accounts with enabled text messaging service only and available for people with mobile phone numbers provided.

So, if your account has enabled text messaging service and a person you want to call has a mobile phone number provided you may want to send the predefined text message to start a visit.

# Text the person to start visit no 81
$ http PATCH https://secure.yardman.io/api/visits/81/text_person \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTIzMDk1ODEzfQ.NfzTTUPBarJA0hYcPNUJDPspzz3R0AviIXP5W_E9bXA"

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: Fri, 06 Apr 2018 10:20:18 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: 484953ff-8a91-489e-bcd0-702e8c8f0376
X-Runtime: 0.016237
X-XSS-Protection: 1; mode=block

Shortly, the person will get your text message to start the visit.

Indicate that a person has been called

This method might be helpful if you want to indicate that a person has been called to start a visit.

# Indicate that person has been called to start visit no 81
$ http PATCH https://secure.yardman.io/api/visits/81/call_person \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTIzMDk1ODEzfQ.NfzTTUPBarJA0hYcPNUJDPspzz3R0AviIXP5W_E9bXA"

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: Fri, 06 Apr 2018 10:20:18 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: 484953ff-8a91-489e-bcd0-702e8c8f0376
X-Runtime: 0.016237
X-XSS-Protection: 1; mode=block

Manage arrival at and departure from checkpoints

Arrival (check in) - without defined place

This method is allowed for accounts with enabled random place allocation option only (Account & Settings > Account > Edit)

# Check in the visitor at checkpoint no 98 (Entry Gate) for visit no 81
$ http PATCH https://secure.yardman.io/api/visits/81/checkpoints/98/arrive \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTIzMDk1ODEzfQ.NfzTTUPBarJA0hYcPNUJDPspzz3R0AviIXP5W_E9bXA"

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: Fri, 06 Apr 2018 11:37:21 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: 005dae5b-450e-4924-ad97-b77cdbac9678
X-Runtime: 0.136338
X-XSS-Protection: 1; mode=block

The visitor is now checked in (arrived) at checkpoint no 98 (Entry Gate here).

Arrival (check in) - at defined place

# Check in the visitor at checkpoint no 105 (Entry Gate), at place no 2379 (Gate 6) for visit no 870
$ http PATCH https://secure.yardman.io/api/visits/870/checkpoints/105/places/2379/arrive
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTIzMDk1ODEzfQ.NfzTTUPBarJA0hYcPNUJDPspzz3R0AviIXP5W_E9bXA"
HTTP/1.1 204 No Content
Cache-Control: no-cache
Connection: keep-alive
Date: Thu, 18 Feb 2021 12:58:17 GMT
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=15552000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 51d3113c-97e0-47c6-b19a-feb83c258d42
X-Runtime: 0.187173
X-XSS-Protection: 1; mode=block

The visitor is now checked in (arrived) at checkpoint no 105 (Entry Gate here).

Departure (check out)

# Check out the visitor from checkpoint no 98 (Entry Gate) for visit no 81
$ http PATCH https://secure.yardman.io/api/visits/81/checkpoints/98/depart \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTIzMDk1ODEzfQ.NfzTTUPBarJA0hYcPNUJDPspzz3R0AviIXP5W_E9bXA"

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: Fri, 06 Apr 2018 11:45:38 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: a7aa6393-3946-41e2-969a-8b807ac4a17a
X-Runtime: 0.142195
X-XSS-Protection: 1; mode=block

The visitor is now checked out (departed) from checkpoint no 98 (Entry Gate here)

Delete existing visit

To delete a visit you have to provide its id value. You may obtain one from the list of visits described above.

# Delete existing visit
$ http DELETE https://secure.yardman.io/api/visits/81 \
> 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.