Create maintenance work orders using a user-defined action
/fscmRestApi/resources/11.13.18.05/maintenanceWorkOrders/action/createConditionBasedWorkOrders
Request
-
Metadata-Context:
If the REST API supports runtime customizations, the shape of the service may change during runtime. The REST client may isolate itself from these changes or choose to interact with the latest version of the API by specifying this header. For example: Metadata-Context:sandbox="TrackEmployeeFeature".
-
REST-Framework-Version:
The protocol version between a REST client and service. If the client does not specify this header in the request the server will pick a default version for the API.
- application/vnd.oracle.adf.action+json
Response
- application/json
- application/vnd.oracle.adf.actionresult+json
Default Response
object
-
result(required): string
If the action completes successfully, then one or more work orders are created for an asset.
Examples
This example describes how to create one or more work orders.
Example cURL Command
Use the following cURL command to submit a request on the REST resource.
curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d 'request payload' "https://servername/fscmRestApi/resources/version/maintenanceWorkOrders"
Example 1 Request Body
The following example includes the contents of the request body in JSON format to create work orders based on a matching condition code defined in a work requirement of a maintenance program. You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.
{ "name": "createConditionBasedWorkOrders", "parameters": [ { "workOrderTypeCode":"CORRECTIVE" }, { "workOrderSubTypeCode":"ORA_CONDITION_BASED" }, { "assetNumber":"ENGINE-ASSET-01" }, { "organizationCode":"M1" }, { "conditionCode":"OIL-LEAK,OVER-HEATING" } ] }
Example 1 Response Body
The following example includes the contents of the response body in JSON format:
Work Order ID : WorkOrderID1,WorkOrderID2
Example 2 Request Body
The following example includes the contents of the request body in JSON format to create one work order with only a default operation if there is no matching condition code. You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.
{ "name": "createConditionBasedWorkOrders", "parameters": [ { "workOrderTypeCode":"CORRECTIVE" }, { "workOrderSubTypeCode":"ORA_CONDITION_BASED" }, { "assetNumber":"ENGINE-ASSET-01" }, { "organizationCode":"M1" }, { "conditionCode":"HIGH_PRESSURE } ] }
Example 2 Response Body
The following example includes the contents of the response body in JSON format:
Work Order ID : WorkOrderID1
Example 3 Request Body
The following example includes the contents of the request body in JSON format to create one or more work orders based on a matching/no matching condition code with document reference (full payload).
Additional rules for the full payload:
- Both plannedStartDate and plannedCompletionDate
are optional.
- If only plannedStartDate is provided then plannedEndDate is defaulted to plannedStartDate.
- If only plannedEndDate is provided then plannedStartDate is defaulted to plannedEndDate.
- If both are not provided, then they are defaulted to sysdate.
- workOrderTypeCode can only be CORRECTIVE and workOrderSubTypeCode can only be ORA_CONDITION_BASED
You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.
{ "name"": "createConditionBasedWorkOrders", "parameters": [ { "workOrderTypeCode": "CORRECTIVE" }, { "workOrderSubTypeCode": "ORA_CONDITION_BASED" }, { "assetNumber": "MNTCDRMASSET02" }, { "organizationCode": "MNTALM" }, { "conditionCode": "OIL-LEAK,OVER-HEATING" }, { "workOrderDescription": "optional description" }, { "plannedStartDate":"2020-08-01 12:00:00" }, { "plannedCompletionDate":"2020-08-02 12:00:00" }, { "documentType" :"ORA_IOT_INCIDENT" }, { "documentNumber":"1234" } ] }
Example 3 Response Body
The following example includes the contents of the response body in JSON format:
Work Order ID : WorkOrderID1,WorkOrderID2