Background and strategic fit
The purpose of this Integration is to pull over different profileinformation to support our growing customer base to analyze the data they are entering through the ProcessMAP solution.This document provides information on how to consume the API's by the end Users.
Assumptions
User Interaction
Operational Profile
Profile Details
Request
GET /iapi/opm/profiles?locationCode={locationCode}&dateFrom={dateFrom}&dateTo={dateTo}&lastSyncedDate={lastSyncedDate}
Ex: /iapi/opm/profiles?locationCode=westlake&dateFrom=2021-03-01&dateTo=2021-03-31&lastSyncedDate=2021-01-01
URI Parameters
Location Code, DateFrom, DateTo and LastSyncedDate are to be passed as parameters.
DateFrom and DateTo are required when LastSyncedDate is not provided.
When DateFrom, DateTo and LastSyncedDate are provided, data will be returned based on LastSyncedDate only.
Name | Description | Type | Additional information |
---|---|---|---|
locationCode | Represents the unique code of location for which Incident records to return. | string | Required |
dateFrom | Represents the starting date of Incident records to return. | date | Required but value optional |
dateTo | Represents the ending date of Incident records to return. | date | Required but value optional |
lastSyncedDate | Represents the data from incident created date or incident modified date. | date | Required but value optional |
Headers
Name | Description | Sample |
---|---|---|
Authorization | Represents the value of the authentication token. | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ... |
ConsumerId | Represents the value of the consumer id. | 2426 |
Errors/Validation Messages
Generic Error codes are given below.
HTTP ERROR 401
{
"HttpStatusCode": 401,
"HttpStatus": "Unauthorized",
"ErrorCode": 1030,
"ErrorMessage": "Invalid tenant."
}
If the location code given is invalid:
{
"Message": "Invalid Location Code"
}
(When FromDate, ToDate and LastSyncedDate are empty) or (FromDate, ToDate and LastSyncedDate are given in incorrect format of DD-MM-YYYY)
{
"Message": "Date From or Date To should not be empty"
}
When FromDate is greater than ToDate and LastSyncedDate is empty
{
"Message": "Date From is greater than Date To"
}
When LastSyncedDate is greater than current date
{
"Message": "Last Synced Date is a Future Date"
}
Questions
Below is a list of questions to be addressed as a result of this requirements document:
Question | Outcome |
---|---|
We would like to start playing with Location (papi/v1/location) and IMS (papi/v1/ims) services and I have a few questions. | Data would be exposed per Location |
I assume we have to use the App (papi/v1/auth/app) Endpoint to obtain the authentication token for our Integration application to submit further requests. How can we obtain ConsumerId, App Id and ConsumerKey? How long the token is valid? How will we find out that the token has expired (HTTP 401,403)? | Any Existing Valid User credentials along with the ConsumerKey can be used to call the Auth API.PMAP would provide the Unique ConsumerKey to the Customer. If the User is valid, an Authorization Token is generated which can be used further in the Header to call Module Endpoints.If it is successful, data can be extracted else HTTP 401 Error is thrown. Each Authorization Token is valid for lifetime unless there is any change in the ConsumerKey. User can request PMAP to reset the Token anytime. |
How can we obtain UserId required for papi/v1/locations/all/{UserId} and other services? Does UserId identify Bunge as a user among other customers? | Yes.. Any Existing Valid User credentials for any specific customer can be used to call the Auth API. |
papi/v1/ims/incidents service specifies that LocationId is required and accepts only a single value. Does it mean that we have to submit a request for each location? Can you describe the effect of the lastSynced parameter? | Yes.For now the data can be viewed for one Location only per request. |