Skip to content

Car Service

Cody Ley-Han edited this page Apr 5, 2018 · 1 revision

Types

Car

{
    "id": {
        "description": "Unique identifier",
        "type": "string"
    },
    "make": {
        "description": "car make eg Honda, Ford, etc",
        "type": "string"
    },
    "model": {
        "description": "car model eg Civic, F150, etc",
        "type": "string"
    },
    "year": {
        "description": "model year of the car",
        "type": "integer",
        "exclusiveMinimum": 0
    },
    "color": {
        "description": "car color",
        "type": "string"
    },
    "user_id": {
        "description": "user who owns the vehicle",
        "type": "string"
    },
    "created_at": {
        "type": "string",
        "format": "date-time in RFC3339 format"
    },
    "updated_at": {
        "type": "string",
        "format": "date-time in RFC3339 format"
    }
}

Endpoints

List: GET /api/v1/cars/

Authorization: Admin

Response

{
    "cars": ["Car"]
}

Show: GET /api/v1/cars/:id

Response

{
    "car": "Car"
}

Create: POST /api/v1/cars

Request

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "properties": {
        "make": {
            "description": "car make eg Honda, Ford, etc",
            "type": "string"
        },
        "model": {
            "description": "car model eg Civic, F150, etc",
            "type": "string"
        },
        "year": {
            "description": "model year of the car",
            "type": "integer",
            "exclusiveMinimum": 0
        },
        "color": {
            "description": "car color",
            "type": "string"
        }
    },
    "required": [
        "make",
        "year",
        "color"
    ]
}

Response

Status Code: 201

{
    "car": "Car"
}

Delete: DELETE /api/v1/cars/:id

Status Code: 204