Yardman Help

Always up-to-date User's Manual and Documentaion for Developers

Yardman Logo

Vehicles 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 vehicles

# Get all vehicles
$ http GET https://secure.yardman.io/api/vehicles \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNTcxNzM0fQ.zsxJJg6khN3cSFnr_B9KYtbkBnIwVwTvFEvgBxi-rDw"

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, 29 Nov 2018 10:11:41 GMT
ETag: W/"0da1309101ca9da0c0b8c296eacc237c"
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: 20b6419f-06e8-40e7-b79a-ecd6868fb8d7
X-Runtime: 0.069685
X-XSS-Protection: 1; mode=block

[
    {
        "brand": "Jelcz",
        "id": 164,
        "model": null,
        "properties": null,
        "registration_number": "AF84344",
        "status": "unknown",
        "vehicle_type": {
            "id": 21,
            "name": "Special"
        }
    },
    {
        "brand": "Toyota",
        "id": 202,
        "model": null,
        "properties": null,
        "registration_number": "AH26199",
        "status": "unknown",
        "vehicle_type": {
            "id": 20,
            "name": "Solo"
        }
    },
    {
        "brand": "Ford",
        "id": 236,
        "model": null,
        "properties": null,
        "registration_number": "AR35666",
        "status": "unknown",
        "vehicle_type": {
            "id": 19,
            "name": "Truck"
        }
    }
    # ... cropped for clarity ...
]

Show vehicle data

To show the vehicle data you have to provide its id value.

# Show vehicle no. 162
$ http GET https://secure.yardman.io/api/vehicles/162 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNTcxNzM0fQ.zsxJJg6khN3cSFnr_B9KYtbkBnIwVwTvFEvgBxi-rDw"

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, 29 Nov 2018 10:18:57 GMT
ETag: W/"8a230707f2486dc248fb4729a00ec3f0"
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: 00761fd0-19ad-479d-99c9-332028365142
X-Runtime: 0.009142
X-XSS-Protection: 1; mode=block

{
    "brand": "Jeep",
    "id": 162,
    "model": null,
    "properties": null,
    "registration_number": "XT48705",
    "status": "unknown",
    "vehicle_type": {
        "id": 21,
        "name": "Special"
    }
}

Create new vehicle

# Create new vehicle
$ http POST https://secure.yardman.io/api/vehicles \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNTcxNzM0fQ.zsxJJg6khN3cSFnr_B9KYtbkBnIwVwTvFEvgBxi-rDw" \
> registration_number=PO48707 \
> brand=Jeep \
> vehicle_type_id=21

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, 29 Nov 2018 10:29:29 GMT
ETag: W/"bdf22ffb4d0612e11db29e28e50af6fa"
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: 91aaadbe-64d0-400b-9583-12d8968196cd
X-Runtime: 0.053484
X-XSS-Protection: 1; mode=block

{
    "brand": "Jeep",
    "id": 655,
    "model": null,
    "properties": null,
    "registration_number": "PO48707",
    "status": "unknown",
    "vehicle_type": {
        "id": 21,
        "name": "Special"
    }
}

Update vehicle data

To update the vehicle data you have to provide its id value and data to be updated.

# Update recently added vehicle
$ http PUT https://secure.yardman.io/api/vehicles/655 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNTcxNzM0fQ.zsxJJg6khN3cSFnr_B9KYtbkBnIwVwTvFEvgBxi-rDw" \
> model=Wrangler

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, 29 Nov 2018 10:32:13 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: 2bab5d37-5198-4419-ac4f-9d536998fb22
X-Runtime: 0.040489
X-XSS-Protection: 1; mode=block

Yardman, our YMS Software