# Example REST API Call to Smart PTI API for Suppliers

# Introduction

In this article, we will explore a regular use case - namely, an REST API GET call to Smart PTI API for Suppliers.

# Prerequisites

In order to be able to successfuly call the API, it is required to:

  • Have your account approved and assgined to an organization.
  • Have a valid application - created and assigned Client-ID and Client-Secret.
  • Have your desired Product subscription request approved for previously created application.

If you have not had a chance yet to go through our ‘Getting Started’ process page, we would recommend you do so – there we explain in details how we to effectively complete the registration and verification process.

# REST API call

Assuming that you have met all the requirements, you are now ready to access our APIs and retrieve real-time shipping information. To initiate API requests successfully, ensure that you include the following headers in each individual request, using the credentials assigned to your created application.

  • X-IBM-Client-ID: %YOUR_CLIENT_ID%"
  • X-IBM-Client-Secret: %YOUR_CLIENT_SECRET%

These headers serve as your individual credentials and are essential for proper API request authentication. The gateway will authenticate and obtain a token, which is then utilized within our internal system.

Make sure to replace %YOUR_CLIENT_ID% and %YOUR_CLIENT_SECRET% with your actual Client-ID and Client-Secret values from created application. This ensures a secure and authenticated connection to our API endpoint.

curl -X GET \
  'https://api-portal.hlag.com/v1/equipment/hllive/pti/status-supplier?container_numbers=OHZU1557747' \
  -H 'accept: application/json' \
  -H 'X-IBM-Client-Id: %YOUR_CLIENT_ID%' \
  -H 'X-IBM-Client-Secret: %YOUR_CLIENT_SECRET%'
{
  "meta": {
    "totalContainers": 4,
    "totalPtiStatus": {
      "visualInspectionRequired": 2,
      "ptiRequired": 1,
      "reeferNotFound": 1
    }
  },
  "data": {
    "visualInspectionRequired": [
      {
        "containerNumber": "ABCD1234567",
        "ptiInformation": {
          "status": "Visual Inspection Required",
          "instructionReason": "No PTI required",
          "lastUpdateDateTime": "2022-08-25T12:40:07.991Z"
        },
        "smartDeviceHealthStatus": "OK"
      },
      {
        "containerNumber": "EFGH1234567",
        "ptiInformation": {
          "status": "Visual Inspection Required",
          "instructionReason": "No PTI required",
          "lastUpdateDateTime": "2022-08-25T12:40:07.991Z"
        },
        "smartDeviceHealthStatus": "OK"
      }
    ],
    "ptiRequired": [
      {
        "containerNumber": "IJKL1234567",
        "ptiInformation": {
          "status": "PTI Required",
          "instructionReason": "Pairing Issue",
          "lastUpdateDateTime": "2022-08-25T12:40:07.991Z"
        },
        "smartDeviceHealthStatus": "PAIRING ISSUE"
      }
    ],
    "reeferNotFound": [
      {
        "containerNumber": "ZZZZ0000000",
        "ptiInformation": {
          "status": "ReeferNotFound"
        }
      }
    ]
  }
}

# Conclusion

Congratulations! You now understand how to successfully call send an REST API call to Smart PTI for Suppliers. By following these steps, you can securely access specific functionalities in our API portfolio and integrate them into your applications. If you encounter any issues or need further assistance, feel free to reach out to our support team for help.