Partner User API

{ "swagger": "2.0", "info": { "version": "2.2.0", "title": "Eagle Eye CameraManager API", "description": "RESTful API for the Eagle Eye CameraManager platform." }, "host": "rest.cameramanager.com", "schemes": [ "http", "https" ], "basePath": "/rest/v2.2", "produces": [ "application/json" ], "definitions": { "Error": { "type": "object", "description": "Generic error response, modelled after RFC 7807.", "properties": { "code": { "type": "integer", "description": "Error code within the system." }, "title": { "type": "string", "description": "This title is not meant to be shown to users and is not guaranteed to stay the same. Please use the code to parse the error." }, "detail": { "type": "string", "description": "Error details, to help developers detect what went wrong." } }, "required": [ "code", "title" ] }, "OAuth2Error": { "type": "object", "description": "Generic OAuth2 error response when there is something wrong with the OAuth2 authentication. Defined at RFC 6749.", "properties": { "error": { "type": "string", "description": "A single ASCII error code conforming the pattern." }, "error_description": { "type": "string", "description": "Human-readable ASCII text providing additional information, used to assist the client developer in understanding the error that occurred." } }, "required": [ "error" ] }, "UserUpdate": { "type": "object", "properties": { "email": { "type": "string", "description": "Email", "maxLength": 255 }, "password": { "type": "string" }, "roleId": { "type": "integer", "description": "Role id" }, "active": { "type": "boolean", "description": "The active status" } } }, "UserMinimal": { "allOf": [ { "$ref": "#/definitions/UserUpdate" }, { "type": "object", "properties": { "userId": { "type": "integer", "description": "ID of the user" } } } ], "required": [ "email", "roleId", "active" ] }, "UserCreate": { "allOf": [ { "$ref": "#/definitions/UserUpdate" } ], "required": [ "email", "roleId", "password", "active" ] } }, "responses": { "resourceNotFound": { "description": "Referenced resource could not be found.", "schema": { "$ref": "#/definitions/Error" } }, "unauthorized": { "description": "You are not authenticated. Please authenticate and try again.", "schema": { "$ref": "#/definitions/OAuth2Error" } }, "forbidden": { "description": "You have no permission to access the specified resource.", "schema": { "$ref": "#/definitions/Error" } }, "validationError": { "description": "The supplied object is invalid. Error detail will contain the validation error.", "schema": { "$ref": "#/definitions/Error" } }, "notAcceptableError": { "description": "The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.", "schema": { "$ref": "#/definitions/Error" } }, "conflict": { "description": "There was a conflict while trying to perform your request. See error details for more information.", "schema": { "$ref": "#/definitions/Error" } }, "internalServerError": { "description": "Something went wrong in the server. Please try again.", "schema": { "$ref": "#/definitions/Error" } } }, "parameters": { "accountId": { "name": "accountId", "in": "path", "description": "ID of the account", "required": true, "type": "integer" }, "userId": { "name": "userId", "in": "path", "description": "ID of the user", "required": true, "type": "integer" } }, "paths": { "/accounts/{accountId}/users": { "get": { "summary": "Get a list of users", "description": "Retrieves all users in no specific order", "operationId": "getUsers", "parameters": [ { "$ref": "#/parameters/accountId" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/UserMinimal" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] }, "post": { "summary": "Adds a user.", "description": "Adds a user. It returns a conflict error message in case email already exists. A patch request can be made after creation to update the user's details.", "operationId": "addUser", "parameters": [ { "$ref": "#/parameters/accountId" }, { "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/UserCreate" } } ], "consumes": [ "application/json" ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/UserMinimal" } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "406": { "$ref": "#/responses/notAcceptableError" }, "409": { "$ref": "#/responses/conflict" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] } }, "/accounts/{accountId}/users/{userId}": { "get": { "summary": "Retrieves a single user", "description": "Retrieves a single user.", "operationId": "getUser", "parameters": [ { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/UserMinimal" } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] }, "patch": { "summary": "Updates a single user", "description": "Updates a single user. Returns a conflict error if email already exists in database or we try to unassign last admin role", "operationId": "updateUser", "parameters": [ { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" }, { "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/UserUpdate" } } ], "responses": { "204": { "description": "No content" }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "409": { "$ref": "#/responses/conflict" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] }, "delete": { "summary": "Delete a single user", "description": "Delete a single user. Returns a conflict error if it's last admin.", "operationId": "deleteUser", "parameters": [ { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" } ], "responses": { "204": { "description": "No content" }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "409": { "$ref": "#/responses/conflict" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] } } } }

swagger-account-users.yaml