NextGen APIs

POST /integration/work-orders/r1/work-orders/activations

Http Verb

POST

Url

/integration/work-orders/r1/work-orders/activations

Permissions required

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

Last Modified Version

r1

Tech Tags


Available Async

No

BPMN Diagram (TBD)


Business Logic

This API activates a Work Order.

To successfully call the API, the work order must be in DRAFT status and must have at least one operation.

This process also updates the relations between operations for work order with assignation type aggregate.

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: {code} OR {externalSystemId, externalCode}

Output: workOrderId, stateId

If System can obtain the Output fields and stateId is DRAFT → continue to next step.

If System can obtain the Output fields and stateId is not DRAFT → responds with error. Elaboration is stopped.

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

Error Type:

STEP 3 - Work Order Activation

System takes Input fields and actives the WO

API Verb: POST

Resource: /{workOrderId}/activations

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

Request example

Example for Wo Cancellation

JSON
{
  "externalSystemCode": "PGE",
  "code": "WO123"
}

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