Vehicles

All Vehicles for a user

http https://sls-api.sheepcrm.com/selfservice/v2/example/vehicles/ "Authorization: Bearer $APP_API_KEY"
HTTP/1.1 200 OK

{
    "contact_uri": "/example/person/5c7ea02b8b388011210462fc/",
    "vehicles": [
        {
            "capacity": null,
            "co2_emissions": null,
            "colour": null,
            "created": "2022-02-28T18:06:07.336000",
            "display_value": "Tesla Model 3",
            "engine_number": null,
            "extras_json": null,
            "fuel_type": null,
            "identifying_number": null,
            "insurance_date": null,
            "last_updated": "2022-11-23T10:56:41.636000",
            "legacy_uid": null,
            "length": null,
            "make": "Tesla",
            "manufacturer": null,
            "model": "Model 3",
            "model_long": null,
            "mot_date": null,
            "notes": null,
            "owner": null,
            "photo": null,
            "purchase_date": null,
            "record_state": "updated",
            "registration_number": "EX99AMP",
            "sale_date": null,
            "secondary_photos": [],
            "style": null,
            "tags": [],
            "tax_due_date": null,
            "tax_status": null,
            "uid": "621d0f0feb692622a9588405",
            "uri": "/example/vehicle/621d0f0feb692622a9588405/",
            "vehicle_type": "car",
            "warning": "Missing ownership dates for /example/vehicle/621d0f0feb692622a9588405/",
            "year": null
        }
    ]
}

A Single Vehicle

http https://sls-api.sheepcrm.com/selfservice/v2/example/vehicles/621d0f0feb692622a9588405/ "Authorization: Bearer $APP_API_KEY"

HTTP/1.1 200 OK
{
    "vehicle": {
        "capacity": null,
        "co2_emissions": null,
        "colour": null,
        "engine_number": null,
        "extras": {},
        "extras_json": null,
        "fuel_type": null,
        "identifying_number": null,
        "insurance_date": null,
        "legacy_uid": null,
        "length": null,
        "make": "Tesla",
        "manufacturer": null,
        "master_vehicle": "/example/vehicle/6391ffb503f5ff169555816b/",
        "master_vehicle_data": {
            "capacity": null,
            "co2_emissions": null,
            "colour": null,
            "engine_number": null,
            "extras_json": null,
            "fuel_type": null,
            "identifying_number": null,
            "insurance_date": null,
            "legacy_uid": null,
            "length": null,
            "make": "Tesla",
            "manufacturer": null,
            "model": "Model 3",
            "model_long": null,
            "mot_date": null,
            "notes": null,
            "owner": null,
            "photo": "https://s3-eu-west-1.amazonaws.com/sheepcrm/example/vehicle/6391ffb503f5ff169555816b/photo/rhd-model-3-social.png",
            "purchase_date": null,
            "registration_number": null,
            "sale_date": null,
            "secondary_photos": [],
            "style": null,
            "tags": [
                "master"
            ],
            "tax_due_date": null,
            "tax_status": null,
            "vehicle_type": "car",
            "year": null
        },
        "master_vehicle_data_fields_used": [
            "photo",
            "tags"
        ],
        "model": "Model 3",
        "model_long": null,
        "mot_date": null,
        "notes": null,
        "owner": null,
        "owners": [
            {
                "end_date": null,
                "owner_for_display": "Mr James Example",
                "owner_uri": "/example/person/5c7ea02b8b388011210462fc/",
                "start_date": null,
                "uri": "/example/connection/637df77f6769fff7e3a0d6f0/"
            }
        ],
        "photo": "https://s3-eu-west-1.amazonaws.com/sheepcrm/example/vehicle/6391ffb503f5ff169555816b/photo/rhd-model-3-social.png",
        "purchase_date": null,
        "registration_number": "EX99AMP",
        "sale_date": null,
        "secondary_photos": [],
        "style": null,
        "tags": [
            "master"
        ],
        "tax_due_date": null,
        "tax_status": null,
        "vehicle_type": "car",
        "year": null
    }
}

Find a vehicle

http https://sls-api.sheepcrm.com/selfservice/v2/example/vehicles/find/ "Authorization: Bearer $APP_API_KEY" registration_number==EX99AMP
HTTP/1.1 200 OK

{
        ... Subject to change ...
}

Get a single vehicle

http GET https://api.sheepcrm.com/api/v1/sheep-app/user/$USER_ID/vehicles/flock/$FLOCK/<Slugified Vehicle UID>/ "Authorization: Bearer $APP_API_KEY"
HTTP/1.1 200 OK

{
        Vehicle for the user
}

Edit a Vehicle

Edit the vehicle by sending key-value pairs of the fields you want to change.

http PUT https://api.sheepcrm.com/api/v1/sheep-app/user/$USER_ID/vehicles/flock/$FLOCK/<Slugified Vehicle UID>/ "Authorization: Bearer $APP_API_KEY"
HTTP/1.1 200 OK

{
        Vehicle for the user
}

Add an owner to a Vehicle

Ownership of a vehicle is modelled as a connection between a contact and a vehicle.

This is the same end-point as the edit vehicle end-point, but you need to set the new_owner_uri key with a valid contact URI. (Owners can be added to vehicles in the same submission as other changes.)

http PUT https://api.sheepcrm.com/api/v1/sheep-app/user/$USER_ID/vehicles/flock/$FLOCK/<Slugified Vehicle UID>/ "Authorization: Bearer $APP_API_KEY" new_owner_uri=/example/person/5c7ea02b8b388011210462fc/
HTTP/1.1 200 OK

{
    "errors": {},
    "updates": {
        "new_owner_uri": "/example/person/5c7ea02b8b388011210462fc/"
    }
}

Delete a Vehicle ownership

Note the vehicle record will not be deleted, only the ownership connection to the record will be removed.

http DELETE https://api.sheepcrm.com/api/v1/sheep-app/user/$USER_ID/vehicles/flock/$FLOCK/<Slugified Vehicle UID>/ "Authorization: Bearer $APP_API_KEY"
HTTP/1.1 200 OK

{
        "status": "ok"
}