NextGen APIs

POST /integration/work-orders/r1/work-orders/cancellation

Http Verb

POST

Url

/integration/work-orders/r1/work-orders/cancellation

Permissions required

WorkOrder: Edit (fsm.core.workorder.edit)

Last Modified Version

r1

Tech Tags


Available Async

No

BPMN Diagram

diagram.svg

Business Logic

This Integration API cancels a Work Order or Operations (1 or more).

If an operation is present in the payload, the system deletes the operation; otherwise, it deletes the Work Order.

One of code or externalCode must be present. If code is provided it has the precedence among the other fields.

System verifies Permission Required and starts the elaboration that is organized in steps.

STEP 1 - External System Validation

System takes Input fields and checks their existence in internal configuration.

API Verb: GET

Resource: External Systems

Input: externalSystemCode, active=true

Output: externalSystemId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 2 - Work Order Existence

System takes Input fields and checks their existence.

API Verb: GET

Resource: Work Orders

Input: {workOrder.code} OR {externalSystemId, workOrder.externalCode}

Output: workOrderId

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 3 - Work Order Operation

This step is skipped if operation.code is absent.

STEP 3a - Work Order Operation Existence

System takes Input fields and checks the existence of the operation.

API Verb: GET

Resource: Work-orders/Operations

Input: list of [operations.code]

Output: list of [operationId]

If System can obtain the Output fields → continue to next step.

If System can’t obtain the Output fields → responds with error. Elaboration is stopped.

Error Type:

STEP 3b - Operation Cancellation

System takes Input fields and updates the operations.

This step is repeated for each operationId.

API Verb: POST

Resource: operations/{operationId}/cancellation

Input: workOrderId, operationId

Output: Response State

If Response State is SUCCESS → elaboration is stopped with the same result code of Private API. See Response payload fields.

If Response State is ERROR → elaboration is stopped. See Response payload fields.

Error Type:

  • Others - see link in Resource 

STEP 4 - Work Order Cancellation

This step is skipped if operation.code is present.

System takes Input fields and updates the work order.

API Verb: POST

Resource: work-orders/{workOrderId}/cancellations

Input: workOrderId

Output: Response State

If Response State is SUCCESS → elaboration is stopped with the same result code of Private API. See Response payload fields.

If Response State is ERROR → elaboration is stopped. See Response payload fields.

Error Type:

  • Others - see link in Resource


Query String Parameters

Start with a ? and includes parameters listed one after the another separated by &.

Not applicable.

Header Parameters

Parameters included in the request headers. Generally, request headers are used to keep authorization parameters.

Default.

Request Body Parameters

Request body parameters are used when clients send data to the API. They are shipped in a JSON Object only in POST, PUT, or PATCH requests.

Field

Description

Mandatory

Constraint

externalSystemCode

External System Code

Y

Not Blank

code

Work Order Code

N

Null or Not Blank

externalCode

Work Order Code in External System

N

Null or Not Blank

operations

(minOccurs=0,

maxOccurs=N)

Operation Code

N

Null or Not Blank

Request example

Example for Wo Cancellation

JSON
{
    "externalSystemCode": "demoNextGen",
    "externalCode": "ext0001"
}

Example for WO Operations Cancellation

JSON
{
    "externalSystemCode": "SAP",
    "externalCode": "ext0001",
    "operations": [
          {
            "code": "957655436"
          },
          {
            "code": "357655436"
          }
    ]
}

Response documentation

Response payload fields

Compliant with RFC Standard https://www.rfc-editor.org/rfc/rfc9457.html

Extension fields:

Field

Description

Note

code

Extension member of a Problem Details Object that contains the error code

Only for ERROR

Response example

JSON
{
  "type": "about:blank",
  "title": "Not Found",
  "status": 404,
  "detail": "External system string does not exist",
  "instance": "/integration/work-orders/r1/work-orders/cancellation",
  "code": "IA001_001"
}


Response error codes