Skip to content

Instantly share code, notes, and snippets.

@nodox
Last active July 12, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodox/e6c964610e0bf5d52548180469d6752b to your computer and use it in GitHub Desktop.
Save nodox/e6c964610e0bf5d52548180469d6752b to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: RVI HTTP API Spec
version: '0.0.5'
schemes:
- http
- https
consumes:
- application/json
produces:
- application/json
paths:
#
# Path Definitions
#
/vehicles:
get:
description: |
Returns a paged list of all vehicles connected to the application for
the current authorized user
parameters:
- name: limit
in: query
description: |
Number of vehicles to return `minimum: 1` `maximum: 50` `default:
10`
required: false
type: integer
default: 10
minimum: 1
maximum: 50
- name: offset
in: query
description: |
Index to start vehicle list at `minimum: 0` `default: 0`
required: false
type: integer
default: 0
minimum: 0
responses:
'200':
description: Success
schema:
title: VehiclesPage
description: A paged list of vehicle IDs
required:
- vehicles
- paging
properties:
vehicles:
description: An array of vehicle IDs
type: array
items:
description: A vehicle ID (UUID v4)
type: string
pattern: '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}'
example: 36ab27d0-fd9d-4455-823a-ce30af709ffc
paging:
title: Page
description: Metadata about the current list of elements
required:
- count
- offset
properties:
count:
description: |
The total number of elements for the entire query (not
just the given page)
type: integer
example: 25
offset:
description: |
The current start index of the returned element list
type: integer
example: 10
/vehicles/{id}:
parameters:
- $ref: '#/parameters/idParam'
get:
description: |
Returns a single vehicle object, containing identifying information
responses:
'200':
description: Success
schema:
title: Vehicle
description: |
A single vehicle object, containing identifying information
required:
- id
- make
- model
- year
properties:
id:
description: A vehicle ID (UUID v4)
type: string
pattern: '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}'
example: 36ab27d0-fd9d-4455-823a-ce30af709ffc
make:
description: The manufacturer of the vehicle
type: string
enum:
- ABARTH
- ACURA
- ALFA_ROMEO
- ASTON_MARTIN
- AUDI
- BMW
- BAJAJ
- BENTLEY
- BUGATTI
- BUICK
- CADILLAC
- CHEVROLET
- CHRYSLER
- CITROEN
- DODGE
- DUCATI
- FERRARI
- FIAT
- FISKER
- FORD
- GMC
- GEELY
- HERO
- HONDA
- HYUNDAI
- INFINITI
- ISUZU
- JAGUAR
- JEEP
- KAWASAKI
- KIA
- LAMBORGHINI
- LANCHESTER
- LANCIA
- LAND_ROVER
- LEXUS
- LINCOLN
- LOTUS
- MAHINDRA
- MASERATI
- MAZDA
- MCLAREN
- MERCEDES_BENZ
- MINI
- MITSUBISHI
- NISSAN
- OPEL
- PEUGEOT
- PORSCHE
- RAM
- RENAULT
- ROLLS_ROYCE
- SAAB
- SCION
- SMART
- SUBARU
- SUZUKI
- TVS
- TATA
- TESLA
- TOYOTA
- VAUXHALL
- VESPA
- VOLKSWAGEN
- VOLVO
- YAMAHA
example: TESLA
model:
description: The model of the vehicle
type: string
example: Model S
year:
description: The model year
type: integer
example: 2014
/vehicles/{id}/engine:
parameters:
- $ref: '#/parameters/idParam'
get:
description: |
Returns the current state of the vehicle's engine/accessory power
responses:
'200':
description: Success
schema:
title: Engine
description: The current state of the vehicle's engine/accessory power
required:
- state
properties:
state:
description: |
Indicates the state of the vehicle's engine.
OFF: the vehicle is off
ACCESSORY_1: the vehicle has the first-level of accessory
power turned on (the first turn in a standard vehicle or
first press in a keyless vehicle)
ACCESSORY_2: the vehicle has the second-level of accessory
power turned on (the second turn in a stardard vehicle or
second press in a keyless vehicle); note: the vehicle's
engine is NOT started
STARTED: the vehicle's engine is running
type: string
enum:
- OFF
- ACCESSORY_1
- ACCESSORY_2
- STARTED
post:
description: |
Start or stop the vehicle's engine. This also includes the vehicles
with electric motors. `START` allows the driver to start moving the
vehicle
parameters:
- name: body
in: body
required: true
description: |
The action to take on the engine. `START`: start the vehicle with
the ability to drive the vehicle. `STOP`: turn the vehicle off.
`ACCESSORY_1`: turn the vehicle's first level accessory power on
(available on ICE vehicles). `ACCESSORY_2`: turn the vehicle's
second level accessory power on (available on ICE vehicles)
schema:
required:
- action
properties:
action:
type: string
enum:
- START
- STOP
- ACCESSORY_1
- ACCESSORY_2
responses:
'200':
$ref: '#/responses/ActionSuccessResponse'
/vehicles/{id}/fuel:
parameters:
- $ref: '#/parameters/idParam'
get:
description: |
Returns the status of the fuel remaining in the vehicle's gas tank
responses:
'200':
description: Success
schema:
title: Fuel
description: Status of the fuel remaining in the vehicle's gas tank
required:
- range
- percentRemaining
properties:
range:
description: |
The estimated remaining distance the car can travel (in
Kilometers)
type: number
format: double
example: 40.5
percentRemaining:
description: The remaining level of fuel in the tank
type: number
format: double
example: 0.3
/vehicles/{id}/doors:
parameters:
- $ref: '#/parameters/idParam'
get:
description: |
Returns the status of the fuel remaining in the vehicle's gas tank
responses:
'200':
description: Success
schema:
title: Fuel
description: Status of the fuel remaining in the vehicle's gas tank
required:
- range
- percentRemaining
properties:
range:
description: |
The estimated remaining distance the car can travel (in
Kilometers)
type: number
format: double
example: 40.5
percentRemaining:
description: The remaining level of fuel in the tank
type: number
format: double
example: 0.3
parameters:
#
# Parameter Definitions
#
idParam:
name: id
in: path
description: A vehicle ID (UUID v4)
required: true
type: string
pattern: '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}'
responses:
#
# Response Definitions
#
ActionSuccessResponse:
description: Success
schema:
title: Success
description: Success
required:
- status
properties:
status:
description: This will always be set to success for HTTP 200
type: string
enum:
- success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment