CStoreOffice® Support & Learning

Calling Itemized Inventory API

To receive the pre-generated itemized inventory business document via the API, perform the following steps:

  1. Authorize with the Business Documents API
  2. Get the list of directories
  3. Get the list of documents
  4. 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.

  1. Open Business Documents PULL API Swagger UI.
  2. Click the Authorize button.
  3. Type in or paste the authorization token in the Available authorizations popup and click the Authorize button.
  4. 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:

  1. Get the ID of the location (station) from CStoreOffice®.
  2. Expand the /business-unit-level-resources endpoint.
  3. Click the Try it out button.
  4. Select report-exported from the Document type identifier dropdown.
  5. Enter the location ID in the businessUnitId field.
  6. Click the Execute button.
  7. 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:

  1. 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.
  2. 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.

  3. Expand the /business-documents endpoint.
  4. Click the Try it out button.
  5. Enter the value from Step 1 to the Resource identifier field.
  6. Click the Execute button.
  7. The list of available documents will be returned in the Response body field.

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:

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:

  1. 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.
  2. Expand the /business-document endpoint.
  3. Click the Try it out button.
  4. Enter the value from Step 1 to the Path to final document field.
  5. Click the Execute button.
  6. 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:

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.