Step 5. Calling the Brincr API
-
We created an example script in
PHPto make acurlrequest to the Brincr API. This is just an example of doing aGETrequest to thecategoriesendpoint. You can find a full list of all our endpoints in the Swagger documentation.function callCategoriesEndpoint() { $url = 'https://sandbox-api.brincr.com/api/v1/categories'; $curl = curl_init(); $headers = [ 'Accept: application/json', 'Authorization: Bearer YOUR_ACCESS_TOKEN', ]; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_HTTPGET, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($curl); $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); }Url
The API base url is
https://sandbox-api.brincr.com/api/v1/. After that we addcategoriesto access the categories endpoint. For a full list of endpoints (and their corresponding urls) go to the Swagger documentation. Here you can also find more examples on how to make different kind of requests to the Brincr API.Headers
The
AcceptandAuthorizationheaders are required for every call to the Brincr API. TheAcceptheader is set toapplication/jsonbecause all of the API's responses will be injson. For theAuthorizationheader you are required to pass a validaccess token(with the correct scopes) otherwise the Brincr API will return a401 Unauthorizedor403 Forbiddenresponse. -
Responses
Below are listed all the possible responses the Brincr API can give.
200
Successful operation
201
Successfully created
204
Successful operation
401
Unauthorized / Action not allowed
This can happen when no or an invalid access token is provided, the user is inactive or the access token contains invalid data such as an invalid tenant403
Forbidden / Invalid authentication supplied
This usually happens when the required scopes are missing from the access token404
Entity not found
405
Method Not Allowed
422
Unprocessable Entity / Validation exception
429
Too many requests are send
500
Internal Server Error