Calling Itemized Inventory API
- Authorize with the Business Documents API
- Get the list of directories
- Get the list of documents
- Fetch a document
1. Authorize with the Business Documents API
This instruction explains how to authorize with the Business Documents API using the Swagger UI. Before proceeding with the steps below, ensure you have obtained an authorization token.
- Open Business Documents PULL API Swagger UI.
- Click the Authorize button.
- Type in or paste the authorization token in the Available authorizations popup and click the Authorize button.
- Once you have successfully authorized, the Authorize button will display a closed lock icon.
2. Get the list of directories
To receive the full list of directories where prepared JSON files with the itemized inventory for the location are stored:
- Get the ID of the location (station) from CStoreOffice®.
- Expand the /business-unit-level-resources endpoint.
- Click the Try it out button.
- Select report-exported from the Document type identifier dropdown.
- Enter the location ID in the businessUnitId field.
- Click the Execute button.
- The list of available directories will be returned in the Response body field.
Response schema
The list of available directories is returned in JSON format:
{
"resources": [
"5127/12345/reports-exported/20241129/"
],
"count": 1,
"totalCount": 1
}
Key | Type | Description |
---|---|---|
resources | Array of strings | The list of directories where documents are stored. See Itemized Inventory Business Document Format for technical details and naming conventions. |
count | Number | The number of directories returned. |
totalCount | Number | The number of directories returned. |
Command line
You can also get the list of directories using third party REST clients like cURL or Postman by making a GET request to https://business-documents-api.petrosoft.cloud/business-unit-level-resources
endpoint with the following parameters:
- documentType: Must be "report-exported" (without quotes).
- businessUnitId: Location ID.
You can easily generate the full cURL command directly from the Swagger UI without manual typing. It will appear in the Curl field after you click the Execute button.
3. Get the list of documents
To receive the list of prepared JSON files with the itemized inventory for the location:
- Get the directory name from the resources array of /business-unit-level-resources response. Ensure that surrounding quotes are not included when copying the value.
- Expand the /business-documents endpoint.
- Click the Try it out button.
- Enter the value from Step 1 to the Resource identifier field.
- Click the Execute button.
- The list of available documents will be returned in the Response body field.
The date when the report is generated is provided in <4-digit year><2-digit month><2-digit day>
format after the "/reports-exported/". For example, "20241129" for November 29, 2024.
Response schema
The list of available documents is returned in JSON format:
{
"documents": [
{
"fileName": "report-exported_20241129T223005-7211f3cf-533b-43ff-9086-e8382becff8d.json",
"path": "5127/12345/reports-exported/20241129/report-exported_20241129T223005-7211f3cf-533b-43ff-9086-e8382becff8d.json",
"uploadDate": "20241129",
"lastModifed": "2024-11-29T22:30:05.000Z",
"type": "report-exported",
"size": 123,
"businessUnitId": "12345",
}
],
"count": 1,
"totalCount": 1
}
Key | Type | Description |
---|---|---|
fileName | String | The name of the JSON file with itemized inventory data. See Itemized Inventory Business Document Format for technical details and naming conventions. |
path | String | Full path to the JSON file with itemized inventory data. See Itemized Inventory Business Document Format for technical details and naming conventions. |
uploadDate | String | The date when the report was generated in <4-digit year><2-digit month><2-digit day> format. |
lastModifed | String | The timestamp when the report was generated in the ISO 8601 format. |
type | String | Equals to "report-exported". |
size | Number | JSON file size in bytes. |
businessUnitId | String | Identifier of the location (station). |
count | Number | The number of documents returned. |
totalCount | Number | The number of documents returned. |
Command line
You can also get the list of business documents using third party REST clients like cURL or Postman by making a GET request to https://business-documents-api.petrosoft.cloud/business-documents
endpoint with the following parameters:
- resource: The directory name from the /business-unit-level-resources response without surrounding quotes.
You can easily generate the full cURL command directly from the Swagger UI without manual typing. It will appear in the Curl field after you click the Execute button.
4. Fetch a document
To fetch the content of a specific JSON file with the itemized inventory for the location:
- Get the full path to the document from the path value of the /business-documents response. Ensure that surrounding quotes are not included when copying the value.
- Expand the /business-document endpoint.
- Click the Try it out button.
- Enter the value from Step 1 to the Path to final document field.
- Click the Execute button.
- The content of the requested document will be returned in the Response body field.
Command line
You can also get the list of business documents using third party REST clients like cURL or Postman by making a GET request to https://business-documents-api.petrosoft.cloud/business-document
endpoint with the following parameters:
- path: The full path to the document from the path value of the /business-documents response.
You can easily generate the full cURL command directly from the Swagger UI without manual typing. It will appear in the Curl field after you click the Execute button.