Share

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:

  • 1 - Check connection to ERP
  • 2 - Validate work order data in ERP
  • 3 - Create a requisition in the ERP system
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:
  • operationId = 1 only requires the name of the divisions that require this operation to be performed. Use a comma if listing multiple divisions.
  • operationId = 2 has the following, optional, query parameters:
    • Location to which the updates for the specified operation should be sent,
    • Project number,
    • Legacy assembly number, and
    • Name of divisions subscribing to the notification. Use a comma between divisions.
  • operationId = 3 does not require the URL or any additional parameters.
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:

  • read only
  • write only
  • read write
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.

Was this information helpful?