Distributor 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" ] }, "DistributorUpdate": { "type": "object", "properties": { "companyName": { "type": "string", "description": "The company's name.", "maxLength": 255 }, "reference": { "type": "string", "description": "A small note that can be added by the owner of the distributor", "maxLength": 255 }, "email": { "type": "string", "description": "The distributor's contact email address.", "format": "email", "maxLength": 255 }, "active": { "type": "boolean", "description": "The distributor account status. True indicates that the distibutor is active, False indicates that the distributor is inactive." }, "crmId": { "type": "string", "description": "customer identifier used internally by CameraManager platform", "maxLength": 24 } } }, "DistributorMinimal": { "allOf": [ { "$ref": "#/definitions/DistributorUpdate" }, { "type": "object", "properties": { "distributorId": { "type": "integer", "description": "ID of the distributor." } } } ], "required": [ "distributorId", "companyName", "reference", "email", "active" ] }, "DistributorCreate": { "allOf": [ { "$ref": "#/definitions/DistributorUpdate" }, { "type": "object", "properties": { "active": { "type": "boolean", "description": "The distributor account status. True indicates that the distibutor is active, False indicates that the distributor is inactive.", "default": true } } } ], "required": [ "companyName", "reference", "email", "crmId" ] }, "Address": { "type": "object", "properties": { "address": { "type": "string", "description": "The distributor's address.", "maxLength": 256 }, "zipCode": { "type": "string", "description": "The distributor's zip code.", "maxLength": 16 }, "city": { "type": "string", "description": "The city where the distributor is located.", "maxLength": 256 }, "country": { "type": "string", "description": "The country where the distributor is located in the ISO 3166-1 alpha-2 format.", "pattern": "[A-Z]{2}", "minLength": 2, "maxLength": 2 } } }, "DistributorDetailsUpdate": { "allOf": [ { "$ref": "#/definitions/DistributorUpdate" }, { "$ref": "#/definitions/Address" }, { "type": "object", "properties": { "firstName": { "type": "string", "description": "The first name of the company's contact person.", "maxLength": 256 }, "lastName": { "type": "string", "description": "The last name of the company's contact person.", "maxLength": 256 }, "vatNumber": { "type": "string", "description": "The distributor's VAT number.", "maxLength": 32 }, "phone": { "type": "string", "description": "The distributor's phone number.", "maxLength": 255 }, "website": { "type": "string", "description": "The distributor's website.", "maxLength": 256 }, "language": { "type": "string", "description": "The main language used by the distributor in the ISO_639-1 format.", "pattern": "[a-z]{2}", "minLength": 2, "maxLength": 2 }, "timeZone": { "type": "string", "description": "The time zone name the distributor is located in according to the TZ database https://en.wikipedia.org/wiki/List_of_tz_database_time_zones", "maxLength": 64 }, "currency": { "type": "string", "description": "The currency that the distributor should be invoiced for. ISO_4217 format", "minLength": 3, "maxLength": 3 }, "discountLevel": { "type": "integer", "minimum": 0, "maximum": 100, "description": "For a distributor or a reseller of CM distributor, it's the discount percentage that partner has with CM. For a reseller of any other distributor, it's the discount percentage the distributor has given to its reseller." } } } ] }, "DistributorDetails": { "allOf": [ { "$ref": "#/definitions/DistributorDetailsUpdate" }, { "type": "object", "properties": { "distributorId": { "type": "integer", "description": "ID of the distributor." }, "active": { "type": "boolean", "description": "The distributor active status. True indicated that the distibutor is active, False indicated that the distributor is inactive." } } } ] }, "DistributorCounts": { "type": "object", "properties": { "customerCount": { "type": "integer", "description": "The total amount of customers of each distributor's reseller." }, "resellerCount": { "type": "integer", "description": "The amount of resellers the distributor has." }, "cameraCount": { "type": "integer", "description": "The total amount of cameras of each distributor's reseller." } } } }, "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": { "distributorId": { "name": "distributorId", "in": "path", "description": "ID of the distributor.", "required": true, "type": "integer" } }, "paths": { "/distributors": { "get": { "summary": "Get a list of distributors", "description": "Retrieves all distributors in no specific order", "operationId": "getDistributors", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/DistributorMinimal" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "Distributors" ] }, "post": { "summary": "Adds a Distributor.", "description": "Adds a Distributor. It returns a conflict error message in case contact email already exists. A patch request can be made after creation to update the distributor's details.", "operationId": "addDistributor", "parameters": [ { "name": "Distributor", "in": "body", "required": true, "schema": { "$ref": "#/definitions/DistributorCreate" } } ], "consumes": [ "application/json" ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/DistributorMinimal" } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "406": { "$ref": "#/responses/notAcceptableError" }, "409": { "$ref": "#/responses/conflict" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "Distributors" ] } }, "/distributors/{distributorId}": { "get": { "summary": "Retrieves a single distributor", "description": "Retrieves a single distributor.", "operationId": "getDistributor", "parameters": [ { "$ref": "#/parameters/distributorId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/DistributorMinimal" } }, "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": [ "Distributors" ] }, "patch": { "summary": "Updates one or more of the distributors core information", "description": "(Partly) updates a single distributor's core details. Returns a conflict error if email already exists in database.", "operationId": "updateDistributor", "parameters": [ { "$ref": "#/parameters/distributorId" }, { "name": "Distributor", "in": "body", "required": true, "schema": { "$ref": "#/definitions/DistributorUpdate" } } ], "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": [ "Distributors" ] } }, "/distributors/{distributorId}/details": { "get": { "summary": "Retrieves a single distributor's more in depth details", "description": "Retrieves a single distributor's details.", "operationId": "getDistributorDetails", "parameters": [ { "$ref": "#/parameters/distributorId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/DistributorDetails" } }, "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": [ "Distributors" ] }, "patch": { "summary": "Partly updates a single distributor's details", "description": "(Partly) updates a single distributor's details.", "operationId": "updateDistributorDetails", "parameters": [ { "$ref": "#/parameters/distributorId" }, { "name": "DistributorDetails", "in": "body", "required": true, "schema": { "$ref": "#/definitions/DistributorDetailsUpdate" } } ], "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" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "Distributors" ] } }, "/distributors/{distributorId}/count": { "get": { "summary": "Retrieves counts of objects related the distributor", "description": "Retrieves a single distributor's object counts such as cameras, customers and resellers.", "operationId": "getDistributorCounts", "parameters": [ { "$ref": "#/parameters/distributorId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/DistributorCounts" } }, "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": [ "Distributors" ] } } } }
Distributors API YAML Specification
swagger-distributors.json