{ "swagger": "2.0", "info": { "description": "API for the user profile in the My Driving example app. https://github.com/Azure-Samples/openhack-devops", "version": "0.1.0", "title": "My Driving User Profile API" }, "basePath": "/api", "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/healthcheck/user": { "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/DefaultResponse" } } }, "tags": [ "User Profile" ] } }, "/version/user": { "x-swagger-router-controller": "version", "get": { "description": "Returns APP_VERSION environment variable to ensure API is running with a specific version", "responses": { "200": { "description": "Build Version", "schema": { "$ref": "#/definitions/Version" } }, "default": { "description": "An error occurred", "schema": { "$ref": "#/definitions/DefaultErrorResponse" } } } } }, "/user": { "get": { "description": "List all user profiles", "operationId": "getAllUsers", "parameters": [], "responses": { "200": { "description": "List of all users", "schema": { "type": "array", "items": { "$ref": "#/definitions/Profile" } } }, "default": { "description": "An error occurred", "schema": { "$ref": "#/definitions/DefaultResponse" } } }, "x-swagger-router-controller": "user", "tags": [ "User Profile" ] } }, "/user/{userID}": { "parameters": [ { "name": "userID", "in": "path", "description": "User's unique ID", "type": "string", "required": true } ], "get": { "description": "Get a User Profile by ID", "operationId": "userGET", "responses": { "200": { "description": "List of profiles", "schema": { "type": "array", "items": { "$ref": "#/definitions/Profile" } } }, "default": { "description": "An error occurred", "schema": { "$ref": "#/definitions/DefaultResponse" } } }, "x-swagger-router-controller": "user", "tags": [ "User Profile" ] }, "post": { "description": "Declares and creates a new profile", "operationId": "userPOST", "parameters": [ { "in": "body", "name": "_profile", "description": "Details of the profile", "required": true, "schema": { "$ref": "#/definitions/Profile" } } ], "responses": { "201": { "description": "Creation successful", "schema": { "$ref": "#/definitions/Profile" }, "headers": { "location": { "type": "string" } } }, "default": { "description": "An error occurred", "schema": { "$ref": "#/definitions/DefaultResponse" } } }, "x-swagger-router-controller": "user", "tags": [ "User Profile" ] }, "patch": { "description": "Update User", "operationId": "updateUser", "responses": { "200": { "description": "User Updated", "schema": { "$ref": "#/definitions/Profile" } }, "404": { "description": "User profile not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/DefaultResponse" } } }, "tags": [ "User Profile" ] }, "delete": { "description": "Delete User By ID", "operationId": "userDELETE", "responses": { "204": { "description": "User Deleted" }, "404": { "description": "User not found" }, "default": { "description": "Unknown Error", "schema": { "$ref": "#/definitions/DefaultResponse" } } }, "tags": [ "User Profile" ] } } }, "definitions": { "Healthcheck": { "type": "object", "properties": { "message": { "type": "string", "description": "" }, "status": { "type": "string", "description": "" } } }, "Version": { "type": "string" }, "Profile": { "type": "object", "properties": { "Id": { "type": "string", "description": "User's unique identity" }, "FirstName": { "type": "string", "minLength": 0, "maxLength": 50, "pattern": "^[A-Za-z \u0000-][a-zA-Z \u0000-]*$" }, "LastName": { "type": "string", "minLength": 0, "maxLength": 80, "pattern": "^[A-Za-z \u0000-][a-zA-Z \u0000-]*$" }, "UserId": { "type": "string", "description": "User's identity" }, "ProfilePictureUri": { "type": "string", "format": "binary", "description": "User's Profile picture" }, "Rating": { "type": "integer", "description": "User's rating" }, "Ranking": { "type": "integer", "description": "User's ranking" }, "TotalDistance": { "type": "number", "format": "float", "description": "User's total distance traveled" }, "TotalTrips": { "type": "integer", "format": "long", "description": "User's total number of trips" }, "TotalTime": { "type": "integer", "format": "long", "description": "User's total driving time" }, "HardStops": { "type": "integer", "format": "long", "description": "User's total number of hard stops" }, "HardAccelerations": { "type": "integer", "format": "long", "description": "User's total number of hard accelerations" }, "FuelConsumption": { "type": "number", "format": "float", "description": "User's amount of fuel consumed" }, "MaxSpeed": { "type": "number", "format": "float", "description": "User's maximum speed" }, "CreatedAt": { "type": "string", "format": "date" }, "UpdatedAt": { "type": "string", "format": "date" }, "Deleted": { "type": "boolean", "description": "Whether the user has been deleted or not." } } }, "DefaultErrorResponse": { "type": "object", "properties": { "status": { "description": "Error code (if available)", "type": "integer", "format": "int32" }, "message": { "description": "Error Message", "type": "string" } } }, "DefaultResponse": { "type": "object", "properties": { "status": { "description": "Error code (if available)", "type": "integer", "format": "int32" }, "message": { "description": "Error Message", "type": "string" } } } } }