Articles on: For developers
This article is also available in:

General information on working with the API

Pricer24 has an API that can be used to integrate with your accounting systems. Please note that the API is not available with all pricing plans.

General Information



The endpoint for working with the API is https://api.pricer24.com/
The API uses a REST architecture.
All API requests and responses use the JSON format.
You need an API key to work with the API.
Descriptions of existing methods and their parameters can be found in Swagger: you can send ready-made requests and view the server’s response.

Limitations



No more than 10 requests per second
Request execution timeout is 60 seconds
If three errors are received within 60 seconds, the key will be blocked for 30 seconds.

Authorization



To authorize, you need to add the query parameter ApiKey with the value of your key to the request. In general, your request will look like this:
https://api.pricer24.com/v1/{назва_ресурсу}?ApiKey={key}&Param1={value1}&Param2={value2}

Obtaining an API Key



To work with the API, we recommend creating a separate user exclusively for data exchange.

In the system, go to Settings → Company → Users.
Select Create on the top panel and create a new user.
Open the created user.
In the Roles tab, add the necessary rights to the user.
In the API Keys tab, choose Create.

The created key is automatically copied to the clipboard. You can now use it to access API.

Pagination



Most GET methods in the API support pagination. To work with pagination, you need to use the query parameters:
MaxResultCount – how many records need to be returned
SkipCount – how many records need to be skipped

Features



The maximum possible value for MaxResultCount is 1000. If you pass a larger value, you will get an error.
By default, MaxResultCount is 10; if the parameter is not passed, the server will return only 10 records.
By default, SkipCount is 0.
The total number of records is contained in the totalCount property of the result object:


In general, your request will look like this: GET https://api.pricer24.com/v1/{method}?SkipCount={PageSize}*{PageNumber-1}&MaxResultCount={PageSize}&ApiKey={key}, where:
PageSize – page size (the number of items returned on one page)
PageNumber – page number

The number of pages can be calculated using the simple formula Ceil(TotalCount / PageSize), where Ceil means rounding up to the nearest whole number.

Example



If the total number of records is 2700 and we receive 1000 records per response, to get all records, we need to send 3 requests:

https://api.pricer24.com/v1/{имя_ресурса}?SkipCount=0&MaxResultCount=1000&ApiKey={key} – get the first 1000 records.
https://api.pricer24.com/v1/{имя_ресурса}?SkipCount=1000&MaxResultCount=1000&ApiKey={key} – get the next 1000 records.
https://api.pricer24.com/v1/{имя_ресурса}?SkipCount=2000&MaxResultCount=1000&ApiKey={key} – get the last 700 records.

Query Parameter Include



To minimize the response size, the default response returns minimal information about objects. To get detailed information, you need to pass the query parameter Include, where you list the objects for which you need detailed information, separated by commas.

Example



When sending the request GET https://api.pricer24.com/v1/contractors?ApiKey={key} without Include, the server will return the following response:


The contractorPriceTypes and contractorWarehouses arrays have null values, as they are not returned by the server.

However, if you send the request GET https://api.pricer24.com/v1/contractors?ApiKey={key}&Include=PriceTypes,Warehouses, the response will already contain the contractor’s prices and warehouses:


Error Handling



The server returns standard response codes:

200 – request successfully executed
401 – authorization error
403 – insufficient permissions
404 – method not found
501 – internal server error (most likely, the request is incorrectly formatted)

In case of an error, information about it will be returned in the error object:

Also, to determine whether the request was successful, you can check the success property, where true means the request was successfully executed and false means an error occurred during execution.

Updated on: 28/08/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!