Account Users API

{ "swagger": "2.0", "info": { "version": "2.0.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.0", "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" ] }, "AccountUserDetails": { "type": "object", "properties": { "language": { "type": "string", "description": "The main language used by the account in the ISO_639-1 format.", "pattern": "[a-z]{2}", "default": "en", "minLength": 2, "maxLength": 2 }, "timeZone": { "type": "string", "description": "The time zone name the account is located in according to the TZ database https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to resellers time zone", "maxLength": 64 } } }, "AccountUserUpdate": { "allOf": [ { "$ref": "#/definitions/AccountUserDetails" }, { "type": "object", "properties": { "email": { "type": "string", "description": "User's email.", "maxLength": 255, "minLength": 5 }, "firstName": { "type": "string", "description": "The first name of the user." }, "lastName": { "type": "string", "description": "The last name of the user." }, "blocked": { "type": "boolean", "description": "if set to True this user cannot login into the system." } } } ] }, "Role": { "type": "string", "enum": [ "owner", "user" ] }, "AccountUser": { "allOf": [ { "$ref": "#/definitions/AccountUserUpdate" }, { "type": "object", "properties": { "userId": { "type": "integer", "description": "ID of the user." }, "accountId": { "type": "integer", "description": "ID of the user's account" }, "resellerId": { "type": "integer", "description": "ID of the reseller this account is belonging to" }, "role": { "$ref": "#/definitions/Role" }, "allowsHelpdesk": { "type": "boolean", "description": "if set to True this user allows support to run client application." } } } ] }, "AccountUserCreate": { "allOf": [ { "$ref": "#/definitions/AccountUserUpdate" } ], "required": [ "email", "firstName", "lastName" ] }, "AccountUserCredentials": { "type": "object", "description": "Contains an overview of the access methods to the users account.", "properties": { "usernameAndPassword": { "type": "object", "description": "Contains whether the user is able to login using username and password.", "properties": { "enabled": { "type": "boolean" } }, "required": [ "enabled" ] }, "partnerTokenGeneration": { "type": "object", "description": "Contains whether access tokens can be generated by partner.", "properties": { "enabled": { "type": "boolean" } }, "required": [ "enabled" ] } }, "required": [ "usernameAndPassword", "partnerTokenGeneration" ] }, "AccountUserCredentialsUpdate": { "type": "object", "description": "Update for any of the access methods to the users account.", "properties": { "usernameAndPassword": { "type": "object", "description": "Update the password the user is using to login with username and password.", "properties": { "password": { "type": "string" } }, "required": [ "password" ] } } } }, "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": { "resellerId": { "name": "resellerId", "in": "path", "description": "ID of the reseller.", "required": true, "type": "integer" }, "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" }, "role": { "name": "role", "in": "query", "description": "user's role", "required": false, "type": "string", "enum": [ "owner", "user" ] }, "email": { "name": "email", "in": "query", "required": false, "description": "email of the user to return.", "type": "string" } }, "paths": { "/resellers/{resellerId}/accounts/{accountId}/users": { "get": { "summary": "Get a list of users", "description": "Retrieves a list of users for accountID and resellerId specified.", "operationId": "getAccountUsers", "parameters": [ { "$ref": "#/parameters/role" }, { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/AccountUser" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUser" ] }, "post": { "summary": "Adds a user.", "description": "Adds a user to account for specific reseller.", "operationId": "addAccountUser", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "name": "accountUserCreate", "in": "body", "schema": { "$ref": "#/definitions/AccountUserCreate" } } ], "consumes": [ "application/json" ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/AccountUser" } }, "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": [ "AccountUser" ] } }, "/resellers/{resellerId}/accounts/{accountId}/users/{userId}": { "get": { "summary": "Retrieves a single user", "description": "Retrieves a single user. When the user does not exist a resource not found error is thrown.", "operationId": "getAccountUser", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/AccountUser" } }, "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": [ "AccountUser" ] }, "patch": { "summary": "Updates a user", "description": "Updates a user, returns a conflict error if contact email already exists.", "operationId": "updateAccountUser", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" }, { "name": "AccountUserUpdate", "in": "body", "schema": { "$ref": "#/definitions/AccountUserUpdate" } } ], "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": [ "AccountUser" ] }, "delete": { "summary": "Delete a single user.", "operationId": "deleteUser", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" } ], "responses": { "204": { "description": "No content" }, "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": [ "AccountUser" ] } }, "/resellers/{resellerId}/accounts/{accountId}/users/{userId}/credentials": { "get": { "summary": "Get the status of user credentials.", "description": "Retrieve details of the different methods the given user can authenticate themselves to the system.", "operationId": "getAccountUserCredentials", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/AccountUserCredentials" } }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUser" ] }, "patch": { "summary": "Updates a user credentials", "description": "Update the user credentials per method. While updating the user credentials all active tokens by the user are invalidated, resulting in the user having to login.", "operationId": "updateAccountUserCredentials", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "$ref": "#/parameters/accountId" }, { "$ref": "#/parameters/userId" }, { "name": "AccountUserCredentialsUpdate", "in": "body", "schema": { "$ref": "#/definitions/AccountUserCredentialsUpdate" } } ], "responses": { "204": { "description": "No content" }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "409": { "$ref": "#/responses/conflict" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUser" ] } }, "/resellers/all/accounts/all/users": { "get": { "description": "Get all users (owner or not) from all accounts of all resellers belonging to the logged in distributor. This api call can only be used if logged in user belong to a distributor. Optionally, it's possible to filter by user's email.", "operationId": "getAllUsersOfAllResellers", "parameters": [ { "$ref": "#/parameters/role" }, { "$ref": "#/parameters/email" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/AccountUser" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] } }, "/resellers/self/accounts/all/users": { "get": { "description": "Get all users (owner or not) from all accounts belonging to the logged in reseller. Optionally, it's possible to filter by user's email so that only the matching user is returned, if it's found. This endpoint can only be used if logged in user belongs to a reseller.", "operationId": "getAllUsersOfReseller", "parameters": [ { "$ref": "#/parameters/role" }, { "$ref": "#/parameters/email" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/AccountUser" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "403": { "$ref": "#/responses/forbidden" }, "404": { "$ref": "#/responses/resourceNotFound" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "AccountUsers" ] } } } }

swagger-resellers-accounts-users.json