-
Notifications
You must be signed in to change notification settings - Fork 6
/
openapi.yaml
126 lines (126 loc) · 4.2 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
openapi: "3.0.0"
info:
description: "This API accepts a VIN and provides you with its Vehicle Images and Electric charge/Fuel status"
version: "1.0.0"
title: "Sample App - Vehicle Data API"
servers:
- url: http://localhost:3000/api/
paths:
"/vehicle/{vehicleId}":
get:
summary: Get vehicle data by Vehicle ID
description: >
The response object will have fields that are set depending on the type of the vehicle:
For an electric vehicle, the API will respond with `rangeelectric` and `soc`,
while the response object for a car with a combustion engine, the response will include `rangeliquid` and `tanklevelpercent`.
For hybrid cars, all data points will be included.
Data may not be included in the response if it was not submitted by the vehicle or the data could not be retrieved.
If requests failed, error information will be included in the optional fields `fuelstatusError` or `electricvehicleError`.
parameters:
- description: Vehicle identification number (VIN)
in: path
name: vehicleId
required: true
schema:
type: string
example: "WDD2132231A444556"
- description: Authorization Code
in: header
name: X-Authorization-Code
required: true
schema:
type: string
example: goO9Fk2q_4nBaFso-miHSbQPzihu8pmhXFVpmeYw
responses:
"200":
description: Vehicle data was fetched successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/VehicleData"
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
description: User is not authorized to access the api. (e.g., token is expired)
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
description: Vehicle not found.
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
description: Internal Server Error.
tags:
- Vehicle Data
components:
schemas:
VehicleData:
title: Vehicle data schema
type: object
properties:
fuelstatusError:
$ref: "#/components/schemas/ApiErrorSchema"
electricvehicleError:
$ref: "#/components/schemas/ApiErrorSchema"
rangeliquid:
description: Liquid fuel tank range.
type: object
properties:
value:
type: number
example: 300
tanklevelpercent:
description: Liquid fuel tank level.
type: object
properties:
value:
type: number
example: 90
rangeelectric:
description: Electric range.
type: object
properties:
value:
type: number
example: 300
soc:
description: Displayed state of charge for the HV battery.
type: object
properties:
value:
type: number
example: 90
imageUrls:
type: array
items:
type: string
example:
- "http://localhost:3000/images/EXT10-WDD2132231A444556.png"
- "http://localhost:3000/images/INT1-WDD2132231A444556.png"
ApiErrorSchema:
description: Error object to indicate an API request failed and data could not be retrieved
type: object
properties:
status:
description: HTTP status code of the failed API call
type: number
example: 404
errorDetails:
description: Detailed information about the error that occured when trying to retrieve vehicle data
type: object
example:
exveErrorId: "104"
exveErrorMsg: "Not Found"
exveErrorRef: "d0ba84e3-6303-4e41-87d9-6adc8f4d5696"
ErrorResponse:
title: Error response schema
type: object
properties:
message:
type: string