BSN.Cloud Main APIs
Basic Usage Rules and Conventions
Requests Must Be Complete
All the entities and structures sent to the server in the POST/PUT request body must be structurally complete. This means that they must contain all documented properties regardless of whether their values are needed. Unknown and optional values may be specified as either "null" or "0" but must be specified explicitly to remove the need for the server to fill them on its own. In response, the server also will always send complete structures so the client doesn't have to check the presence of each property before reading it.
HTTP Status Codes
The BSN REST API may respond with the following HTTP status codes according to rfc7231: 100, 200, 201, 202, 204, 300, 304, 307, 308, 400, 401, 403, 404, 405, 406, 408, 411, 412, 413, 414, 415, 429, 431, 500, 502, 503, 504, or 505.
Request Values
The actual values in requests must strictly match the data types in the properties. Which data types are nullable and which are not should be clearly defined. See Data Types.
Data Request Structures
Each BSN REST API data request must contain the "Accept" HTTP header. Make sure that it lists only content representations that are really supported by the client. Values like "*" and "application*" are accepted but produce random result from the list of representations supported by the server, which also may change from time to time, according to rfc7231#section-3.4. For example, for most methods you should enter something like Accept: application/json, application/vnd.bsn.error+json instead of Accept */* because Accept */* is ambiguous.
Each BSN REST API data request may also contain an "Accept-Encoding" HTTP header with the list of traffic compression algorithms supported by the client, and expect either non-compressed or compressed by the algorithm specified in "Content-Encoding" HTTP response header according to rfc7231.
Data Response Structure
XML is the default response format. JSON format will be returned if you specify the HTTP request header Accept: application/json.
Conditional Requests
BrightSign BSN REST APIs support conditional requests in all singular entity retrieval editing and removal methods (for example, PUT, DELETE, PATCH). You should use conditional requests when multiple retrievals of the same entity are expected and especially in update and delete requests of a single entity. These are implemented according to rfc2616 on the server side and based on the "Last-Modified", "If-Modified-Since" and "If-Unmodified-Since" HTTP headers.
Traffic Compression
Traffic compression for BSN REST API requests may also be implemented on demand but this case is not described in rfcStandards.
It is good practice to specify the “Accept-Encoding” header in forming the server so that it may compress the response when reasonable (when its size exceeds 800 bytes). The supported compression algorithms are gzip and deflate.