Reseller 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" ] }, "ResellerUpdate": { "type": "object", "properties": { "companyName": { "type": "string", "description": "The company's name.", "maxLength": 255 }, "reference": { "type": "string", "description": "The reseller's reference code." }, "email": { "type": "string", "description": "The reseller's contact email address.", "format": "email", "maxLength": 255 }, "active": { "type": "boolean", "description": "The reseller active status. True indicated that the reseller is active, False indicated that the reseller is inactive." }, "crmId": { "type": "string", "description": "customer identifier used internally by CameraManager platform", "maxLength": 24 } } }, "ResellerMinimal": { "allOf": [ { "$ref": "#/definitions/ResellerUpdate" }, { "type": "object", "properties": { "resellerId": { "type": "integer", "description": "ID of the partner(reseller)." }, "distributorId": { "type": "integer", "description": "ID of the distributor that is associated with this reseller." } } } ], "required": [ "resellerId", "distributorId", "companyName", "reference", "email", "active" ] }, "ResellerCreate": { "allOf": [ { "$ref": "#/definitions/ResellerUpdate" }, { "type": "object", "properties": { "distributorId": { "type": "integer", "description": "Id of the distributor that is associated with this reseller." } } } ], "required": [ "distributorId", "companyName", "reference", "email" ] }, "Address": { "type": "object", "properties": { "address": { "type": "string", "description": "The reseller's address.", "maxLength": 256 }, "zipCode": { "type": "string", "description": "The reseller's zip code.", "maxLength": 16 }, "city": { "type": "string", "description": "The city where the reseller is located.", "maxLength": 256 }, "country": { "type": "string", "description": "The country where the reseller is located in the ISO 3166-1 alpha-2 format.", "pattern": "[A-Z]{2}", "minLength": 2, "maxLength": 2 } } }, "ContactDetails": { "type": "object", "properties": { "firstName": { "type": "string", "description": "The first name of the contact.", "maxLength": 256 }, "lastName": { "type": "string", "description": "The last name of the contact.", "maxLength": 256 } } }, "ResellerDetailsUpdate": { "allOf": [ { "$ref": "#/definitions/ResellerUpdate" }, { "$ref": "#/definitions/Address" }, { "$ref": "#/definitions/ContactDetails" }, { "type": "object", "properties": { "phone": { "type": "string", "description": "The reseller's phone number.", "maxLength": 255 }, "vatNumber": { "type": "string", "description": "The reseller's VAT number.", "maxLength": 32 }, "website": { "type": "string", "description": "The reseller's website.", "maxLength": 256 }, "language": { "type": "string", "description": "The main language used by the reseller in the ISO_639-1 format.", "pattern": "[a-z]{2}", "minLength": 2, "maxLength": 2 }, "currency": { "type": "string", "description": "The currency that the reseller should be invoiced for. ISO_4217 format", "minLength": 3, "maxLength": 3 }, "timeZone": { "type": "string", "description": "The time zone name the reseller is located in according to the TZ database https://en.wikipedia.org/wiki/List_of_tz_database_time_zones", "maxLength": 64 }, "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." } } } ] }, "ResellerDetails": { "allOf": [ { "$ref": "#/definitions/ResellerDetailsUpdate" }, { "type": "object", "properties": { "resellerId": { "type": "integer", "description": "ID of the partner (reseller)." }, "distributorId": { "type": "integer", "description": "ID of the distributor that is associated with this reseller." } } } ] }, "ResellerCounts": { "type": "object", "properties": { "customerCount": { "type": "integer", "description": "The amount of active customers of the reseller" }, "cameraCount": { "type": "integer", "description": "The total camera slots given by each subscription of all reseller's customer" } } } }, "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 partner (reseller).", "required": true, "type": "integer" } }, "paths": { "/resellers": { "get": { "summary": "Get a list of resellers", "description": "Retrieves a paginated list of resellers that can be sorted.", "operationId": "getResellers", "parameters": [ { "name": "distributorId", "type": "integer", "in": "query", "description": "The id of the distributor should this be filtered on.", "required": false } ], "responses": { "200": { "description": "OK", "headers": { "X-link": { "type": "string", "description": "A link containing the api call for the next page returning the next set of users." } }, "schema": { "type": "array", "items": { "$ref": "#/definitions/ResellerMinimal" } } }, "400": { "$ref": "#/responses/validationError" }, "401": { "$ref": "#/responses/unauthorized" }, "404": { "$ref": "#/responses/resourceNotFound" }, "406": { "$ref": "#/responses/notAcceptableError" }, "500": { "$ref": "#/responses/internalServerError" } }, "tags": [ "Resellers" ] }, "post": { "summary": "Adds a reseller.", "description": "Adds a Reseller. It returns a conflict error message in case the contact email already exists.", "operationId": "addReseller", "parameters": [ { "name": "Reseller", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ResellerCreate" } } ], "consumes": [ "application/json" ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/ResellerMinimal" } }, "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": [ "Resellers" ] } }, "/resellers/{resellerId}": { "get": { "summary": "Retrieves a single reseller", "description": "Retrieves a single reseller. When the partner is not a reseller, a resource not found error is thrown.", "operationId": "getReseller", "parameters": [ { "$ref": "#/parameters/resellerId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/ResellerMinimal" } }, "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": [ "Resellers" ] }, "patch": { "summary": "(Partly) updates a single reseller's core information", "description": "(Partly) updates a single reseller's core information, returns a conflict error if contact email already exists.", "operationId": "updateReseller", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "name": "Reseller", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ResellerUpdate" } } ], "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": [ "Resellers" ] } }, "/resellers/{resellerId}/distributor/{distributorId}": { "put": { "summary": "Moves reseller to distributor", "description": "Moves reseller to distributor only if subscriptions between origin and target distributor and reseller are compatible.", "operationId": "moveResellerToDistributor", "parameters": [ { "name": "resellerId", "in": "path", "description": "ID of the reseller.", "required": true, "type": "integer" }, { "name": "distributorId", "in": "path", "description": "ID of the distributor.", "required": true, "type": "integer" } ], "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": [ "Resellers" ] } }, "/resellers/{resellerId}/details": { "get": { "summary": "Retrieves a single reseller's more in depth details", "description": "Retrieves a single reseller's details. When the partner is not a reseller, a resource not found error is thrown.", "operationId": "getResellersDetails", "parameters": [ { "$ref": "#/parameters/resellerId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/ResellerDetails" } }, "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": [ "Resellers" ] }, "patch": { "summary": "(Partly) updates a single reseller's details", "description": "(Partly) updates a single reseller's details.", "operationId": "updateResellerDetails", "parameters": [ { "$ref": "#/parameters/resellerId" }, { "name": "ResellerDetails", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ResellerDetailsUpdate" } } ], "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": [ "Resellers" ] } }, "/resellers/{resellerId}/count": { "get": { "summary": "Retrieves counts of objects related to the reseller", "description": "Retrieves a single reseller's object counts regarding cameras and customers.", "operationId": "getResellersCount", "parameters": [ { "$ref": "#/parameters/resellerId" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/ResellerCounts" } }, "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": [ "Resellers" ] } } } }

swagger-reseller.json