{ "swagger": "2.0", "info": { "version": "0.0.1", "title": "MyDriving Trips API", "description": "API for the user in the My Driving example app. https://github.com/Azure-Samples/openhack-devops-team" }, "basePath": "/api", "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/healthcheck/trips": { "x-swagger-router-controller": "healthcheck", "get": { "description": "Returns healthcheck for systems looking to ensure API is up and operational", "responses": { "200": { "description": "Service is healthy", "schema": { "$ref": "#/definitions/Healthcheck" } }, "default": { "description": "An error occurred", "schema": { "$ref": "#/definitions/error_response_default" } } } } }, "/trips": { "x-swagger-router-controller": "trips", "get": { "description": "Returns all trips", "operationId": "getAllTrips", "responses": { "200": { "description": "Trips found", "schema": { "type": "array", "items": { "$ref": "#/definitions/trip" } } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } } }, "post": { "description": "Create a trip", "operationId": "createTrip", "parameters": [ { "name": "trip", "in": "body", "description": "Trip to add", "required": true, "schema": { "$ref": "#/definitions/trip" } } ], "responses": { "201": { "description": "Trip created", "schema": { "$ref": "#/definitions/trip" } }, "404": { "description": "Trip contains invalid User ID", "schema": { "$ref": "#/definitions/error_response_default" } }, "409": { "description": "Trip already exists", "schema": { "$ref": "#/definitions/error_response_default" } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } } } }, "/trips/user/{userID}": { "x-swagger-router-controller": "trips", "get": { "description": "Returns all trips for a given user", "operationId": "getAllTripsForUser", "responses": { "200": { "description": "Trips found", "schema": { "type": "array", "items": { "$ref": "#/definitions/trip" } } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "userID", "in": "path", "description": "User ID", "type": "string", "required": true } ] } }, "/trips/{tripID}": { "x-swagger-router-controller": "trips", "get": { "description": "Get Trip by ID", "operationId": "getTripByID", "responses": { "200": { "description": "Trip found", "schema": { "$ref": "#/definitions/trip" } }, "404": { "description": "Trip not found", "schema": { "$ref": "#/definitions/error_response_default" } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true } ] }, "patch": { "description": "Update Trip", "operationId": "updateTrip", "responses": { "200": { "description": "Trip Updated", "schema": { "$ref": "#/definitions/trip" } }, "404": { "description": "Trip not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true }, { "name": "trip", "in": "body", "description": "Trip to update", "required": true, "schema": { "$ref": "#/definitions/trip" } } ] }, "delete": { "description": "Delete Trip By ID", "operationId": "deleteTrip", "responses": { "204": { "description": "Trip Deleted" }, "404": { "description": "Trip not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true } ] } }, "/trips/{tripID}/trippoints": { "x-swagger-router-controller": "trippoints", "get": { "description": "Get Trip Points by Trip Id", "operationId": "getTripPoints", "responses": { "200": { "description": "Trip Points found", "schema": { "type": "array", "items": { "$ref": "#/definitions/tripPoint" } } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true } ] }, "post": { "description": "Create Trip Point for Trip", "operationId": "createTripPoint", "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true }, { "name": "tripPoint", "in": "body", "description": "Trip Point to add", "required": true, "schema": { "$ref": "#/definitions/tripPoint" } } ], "responses": { "201": { "description": "Trip Point created", "schema": { "$ref": "#/definitions/tripPoint" } }, "404": { "description": "Trip Point contains invalid Trip ID", "schema": { "$ref": "#/definitions/error_response_default" } }, "409": { "description": "Trip Point already exists", "schema": { "$ref": "#/definitions/error_response_default" } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } } } }, "/trips/{tripID}/trippoints/{tripPointID}": { "x-swagger-router-controller": "trippoints", "get": { "description": "Get Trip Point by Trip ID and Trip Point ID", "operationId": "getTripPointByID", "responses": { "200": { "description": "Trip Point found", "schema": { "$ref": "#/definitions/tripPoint" } }, "404": { "description": "Trip Point not found", "schema": { "$ref": "#/definitions/error_response_default" } }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true }, { "name": "tripPointID", "in": "path", "description": "Trip Point ID", "type": "string", "required": true } ] }, "patch": { "description": "Update Trip Point", "operationId": "updateTripPoint", "responses": { "200": { "description": "Trip Point Updated", "schema": { "$ref": "#/definitions/tripPoint" } }, "404": { "description": "Trip Point not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true }, { "name": "tripPointID", "in": "path", "description": "Trip Point ID", "type": "string", "required": true }, { "name": "tripPoint", "in": "body", "description": "Trip Point to update", "required": true, "schema": { "$ref": "#/definitions/tripPoint" } } ] }, "delete": { "description": "Delete Trip Point By ID", "operationId": "deleteTripPoint", "responses": { "204": { "description": "Trip Point Deleted" }, "404": { "description": "Trip Point not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/error_response_default" } } }, "parameters": [ { "name": "tripID", "in": "path", "description": "Trip ID", "type": "string", "required": true }, { "name": "tripPointID", "in": "path", "description": "Trip Point ID", "type": "string", "required": true } ] } }, "/swagger": { "x-swagger-pipe": "swagger_raw" } }, "definitions": { "Healthcheck": { "type": "object", "properties": { "message": { "type": "string", "description": "" }, "status": { "type": "string", "description": "" } } }, "error_response_default": { "type": "object", "properties": { "status": { "description": "Error code (if available)", "type": "integer", "format": "int32" }, "message": { "description": "Error Message", "type": "string" } } }, "trip": { "type": "object", "properties": { "Id": { "type": "string", "description": "Trip ID", "minLength": 0, "maxLength": 128 }, "Name": { "type": "string", "minLength": 0, "maxLength": 45, "pattern": "^[A-Za-z \u0000-\u007f][a-zA-Z \u0000-\u007f]*$" }, "UserId": { "type": "string", "description": "User's unique identity" }, "RecordedtimeStamp": { "type": "string", "format": "date" }, "EndtimeStamp": { "type": "string", "format": "date" }, "Rating": { "type": "integer", "format": "int32" }, "IsComplete": { "type": "boolean" }, "HasSimulatedOBDData": { "type": "boolean" }, "AverageSpeed": { "type": "number", "format": "float" }, "FuelUsed": { "type": "number", "format": "float" }, "HardStops": { "type": "integer", "format": "int64" }, "HardAccelerations": { "type": "integer", "format": "int64" }, "Distance": { "type": "number", "format": "float" }, "CreatedAt": { "type": "string", "format": "date-time" }, "UpdatedAt": { "type": "string", "format": "date-time" }, "Deleted": { "type": "boolean" } } }, "tripPoint": { "type": "object", "properties": { "Id": { "type": "string", "description": "Trip Point ID", "minLength": 0, "maxLength": 128 }, "TripId": { "type": "string", "description": "Trip ID", "minLength": 0, "maxLength": 128 }, "Latitude": { "type": "number", "format": "float" }, "Longitude": { "type": "number", "format": "float" }, "Speed": { "type": "number", "format": "float" }, "RecordedTimeStamp": { "type": "string", "format": "date" }, "Sequence": { "type": "integer", "format": "int32" }, "RPM": { "type": "number", "format": "float" }, "ShortTermFuelBank": { "type": "number", "format": "float" }, "LongTermFuelBank": { "type": "number", "format": "float" }, "ThrottlePosition": { "type": "number", "format": "float" }, "RelativeThrottlePosition": { "type": "number", "format": "float" }, "Runtime": { "type": "number", "format": "float" }, "DistanceWithMalfunctionLight": { "type": "number", "format": "float" }, "EngineLoad": { "type": "number", "format": "float" }, "MassFlowRate": { "type": "number", "format": "float" }, "EngineFuelRate": { "type": "number", "format": "float" }, "VIN": { "type": "string" }, "HasOBDData": { "type": "boolean" }, "HasSimulatedOBDData": { "type": "boolean" }, "CreatedAt": { "type": "string", "format": "date-time" }, "UpdatedAt": { "type": "string", "format": "date-time" }, "Deleted": { "type": "boolean" } } } } }