Retrieve master data
Learn how to retrieve data from the Proactis APIs
To retrieve master data from Proactis most APIs have two distinct endpoints that serve different purposes: one for fetching a list of results based on filters or pagination, and another for retrieving individual results.
List results endpoint
This endpoint is a fundamental part of the Proactis APIs and allows clients to request a list of results based on specific criteria, such as filters and pagination. This endpoint is particularly useful when dealing with large datasets, where returning all results at once would be impractical or inefficient.
Endpoint URL
The URL is where the client sends its request to fetch a list of results. This URL is designed to be unique and specific to this functionality, and it might look something like
/accounting/v1/{domainId}/costdimensions/CostCenter/values.HTTP method
A
GETrequest is used to interact with this endpoint. This indicates that the client is requesting data from the server.HTTP headers
Proactis APIs require authentication. For this each request requires two HTTP-headers (
Authorizationandx-api-key) to be added.Some APIs also allow the client to indicate the type of response (XML or JSON). This is done by adding the
Acceptheader. The specific API documentation will let you know whether this is supported.Query parameters
Clients can include query parameters in the URL to customize the data they want to retrieve. Some common query parameters used with this endpoint are:
- pageNumber: This parameter indicates which page of results the client wants to retrieve. Pages are used to break up the data into manageable chunks, preventing the need to retrieve the entire dataset at once.
- pageSize: This parameter specifies the number of results to be included in each page. It works in conjunction with the
pageNumberparameter to determine how many results are shown per request. - Additional parameters: Depending on the API's design, there might be other parameters for sorting the results or filtering.
Response
After processing the client's request, the API responds with a XML or JSON array that contains the list of results that match the specified criteria. The response may also include metadata to assist with pagination and result count information.
In the example below, the results array contains the list of results for the requested page, and the
totalElementsfield indicates the total number of results available. ThepageNumberandpageSizefields provide pagination information.- XML
- JSON
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
<pageNumber>0</pageNumber>
<pageSize>2</pageSize>
<totalElements>82</totalElements>
<content>
<costCenter>
<id>CC-001</id>
<online>true</online>
<erpId>HR-654</erpId>
<departments/>
<lastModified>2023-08-17T14:16:17+02:00</lastModified>
</costCenter>
<costCenter>
<id>CA-002</id>
<online>true</online>
<departments/>
<lastModified>2023-07-27T08:07:34+02:00</lastModified>
</costCenter>
</content>
</page>{
"pageNumber": 0,
"pageSize": 2,
"totalElements": 82,
"content": [
{
"online": true,
"erpId": "HR-654",
"departments": [],
"id": "CC-001",
"lastModified": "2023-08-17T12:16:17Z"
},
{
"online": true,
"departments": [],
"id": "CC-002",
"lastModified": "2023-07-27T06:07:34Z"
}
]
}
Individual result endpoint
This endpoint in a RESTful API is used to retrieve detailed information about a single result or item. The endpoint is particularly useful when a client already knows the unique identifier of the item they want to retrieve and need more specific details about it. Here's a more in-depth explanation of how this endpoint works:
Endpoint URL
The URL is constructed in a way that includes the unique identifier of the item to be retrieved. The URL might look something like
/accounting/v1/{domainId}/costdimensions/CostCenter/values/{costCenterId}, where{costCenterId}is the actual identifier of the result you want to retrieve.HTTP Method
Just like with the "List results endpoint", a
GETrequest is used to interact with this endpoint. This signals to the server that the client is requesting information about a specific item.HTTP headers
Proactis APIs require authentication. For this each request requires two HTTP-headers (
Authorizationandx-api-key) to be added.Some APIs also allow the client to indicate the type of response (XML or JSON). This is done by adding the
Acceptheader. The specific API documentation will let you know whether this is supported.Response
After processing the request, the API responds with a XML or JSON object that contains detailed information about the requested item. This information might include various attributes, properties, and any related data associated with the item. In this example, the object contains detailed information about the specific cost center with an ID of
CC-001.- XML
- JSON
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<costCenter>
<id>CC-001</id>
<name>Human Resources</name>
<online>true</online>
<erpId>HR-654</erpId>
<departments>
<department>A-6000</department>
<department>A-1000</department>
</departments>
<lastModified>2023-08-17T14:16:17+02:00</lastModified>
</costCenter>{
"name": "Human Resources",
"online": true,
"erpId": "HR-654",
"departments": [
"A-6000",
"A-1000"
],
"id": "CC-001",
"lastModified": "2023-08-17T12:16:17Z"
}Error Handling
It's important to consider error handling when working with this endpoint. If the client requests an item that doesn't exist or provides an invalid identifier, the API responds with an appropriate error message, typically using appropriate HTTP status codes (e.g., 404 Not Found for a non-existent item).