Subscribe to notifications
POST /api/v1/erp/subscriptions
triggers notifications to be sent to the location specified in the apiRoot
field when a change notice (CN) workflow has a System primitive with Type configured as one of:
- Check Connectivity To ERP Project
- Validate ERP Project
- Send Work Order Data to ERP
Request schema
Method | URL |
---|---|
POST | /api/v1/erp/subscriptions |
Request header
*indicates required fields
Field | Value type | Description of values |
---|---|---|
*Authorization |
String | Enter: Bearer access token. |
*Upc-Selected-Company |
Integer | Company’s ID. Use the value returned in the id field received in response to the following request: GET /api/auth/v1/companies . |
X-User-Id |
Text | Enter the email address of the user being impersonated. This value is required if you are using a two-legged token. If you are using a three-legged token, then this field is not required. |
Request body
Field | Value type | Description of values |
---|---|---|
description |
String | Your descriptive label for the subscription. |
divisions |
String/Array | Divisions subscribing to the notifications. |
supportedOperations |
Array | List of workflow operations to which notifications are subscribed. |
supportedOperations.operationId |
Integer | Accepted values are 1 , 2 , and 3 . Each number represents a type of operation:
|
supportedOperations.path |
String | Path to location where the specified operation’s updates are posted. The required parameters are based on the value of operationId .Note:
|
apiRoot |
String | URL for ERP system or adapter. |
oauth2ClientCredentials |
Array | OAuth credentials. |
oauth2ClientCredentials.clientId |
String | OAuth client Id. |
oauth2ClientCredentials.clientSecret |
String | OAuth client secret. |
oauth2ClientCredentials.tokenURL |
String | OAuth access token. |
oauth2ClientCredentials.scope |
String | Accepted values are:
|
companyId |
String | Company’s ID. Use the value for id received in the response to the following request: GET /api/auth/v1/companies request . |
Sample request
{
"description": "Subscription for ERP updates",
"divisions": [
"Luminous LSM", "Luminous EMC", "Luminous KPL"
],
"supportedOperations": [
{
"operationId": 1,
"path": "/IsAliveByDivision?divisionName=Luminous LSM"
},
{
"operationId": 2,
"path":
},
{
"operationId": 3,
"path": "/CreateRequisitionsAsyncJSON"
}
],
"apiRoot": "https://website.url/3bb131f-2bf74-431d-f50298552ff",
"oauth2ClientCredentials": {
"clientId": "87654321abcdefgh",
"clientSecret": "abcdefgh87654321",
"tokenUrl": "https://my-token-url",
"scope": "read write"
},
"companyId": 1
}
Response schema
If the request for a new subscription already exists for:
- The specified
companyId
; - One or more
divisions
; and supportedOperations
,
Then a 400 http-response code is returned with details in the message
field.
A successfully created subscription returns the data from the request with a 201-http response code.