Work with Equipment

A simple POST/GET/PATCH/DELETE use for Equipment.

Use Case for Equipment

  • POST: The rail carrier lets Transportation and Global Trade Management know that they have a rail car available.
  • GET: When a Rail Car is created in Transportation and Global Trade Management, the shipper can GET the Equipment Initial and Number in order to query Railinc UmlerTM, an Equipment Management Information System to get additional information about the Equipment.
  • PATCH: Update the equipment in Transportation and Global Trade Management with the additional information received from UmlerTM.
  • DELETE: Before the shipper gets to use the equipment, the rail carrier informs the shipper that this equipment is no longer available and cannot be used.

Rail carrier POST an Equipment to OTM

The rail carrier lets Transportation and Global Trade Management know that they have a rail car available. The rail carrier provides details of an equipment such as ID, equipment initial, number etc to create an equipment in the system. This command POSTs an equipment to Transportation and Global Trade Management.
curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.resource+json; type=singular"
-d '{
    "equipmentXid": "40 FT",
    "equipmentName": "EQUIPMENT NAME",
    "equipmentTypeGid": "40 FT GENERAL CONTAINER",
    "equipmentInitial": "ABC",
    "equipmentNumber": "123456",
    "equipmentInitialNumber": "ABC123456",
    "tareWeight": {
        "value": 111111,
        "unit": "LB"
    },
    "aarCarType": "AAR CAR TYPE",
    "licensePlate": "ABC 1234",
    "interchangeRecvLocationGid": "GUEST.PHILADELPHIA",
    "isContainer": true,
    "currentChassisInitial": "XYZ",
    "currentChassisNumber": "789",
    "assignedProduct": "REST ASSIGNED PRODUCT",
    "carDestinationLocationGid": "GUEST.PITTSBURGH",
    "carDestinationEtaDate": {
        "value": "2019-03-24T07:21:00-05:00"
    }
}'
https://servername.us2.oraclecloud.com/logisticsRestApi/resources/v2/equipments

Note:

Although the primary key for Equipment is equipmentGid, any value passed in for it will be ignored. The actual GID persisted to the database will be a concatenation of the XID and domainName properties, if specified.

When a new object is successfully persisted the response will be an HTTP 201 (CREATED) status and the complete resource, including any default values will be returned in the response.

GET Equipment Initial and Number

When a Rail Car is created in Transportation and Global Trade Management, you can GET the Equipment Initial and Number in order to query Railinc UmlerTM, an Equipment Management Information System to get additional information about the Equipment. The following command can be used to issue a GET request from the client to the server.
curl -u username:password -H "Content-Type:application/vnd.oracle.resource+json; type=singular"
https://servername/logisticsRestApi/resources/v2/equipments/{equipmentGid}?fields=equipmentInitial,equipmentNumber
The response payload includes fields requested as part of the request.
{
    "equipmentInitial": "ABC",
    "equipmentNumber": "123456",
}

PATCH to Update Additional Information Retrieved from Umler

The following ways update resources:
  • MERGE PATCH: which is where the message body is in the format of the resource to be updated but containing only those properties whose values are to be modified. The Content-Type header parameter should be:
    • application/vnd.oracle.resource+json; type=singular

    Note:

    Application/json is also supported.

  • JSON PATCH (RFC 6902): is a standard for specifying a number of operations to be performed, in sequence, to a resource identified by URI. The Content-Type header parameter must be:
    • application/json-patch+json

The following example performs a MERGE PATCH. Explore the Learn More sections on the full capabilities of JSON PATCH.

Using the equipment initial and number, you get additional information from the rail car database (UmlerTM). Update the equipment in Transportation and Global Trade Management with the additional information received from UmlerTM. Following command can be used to PATCH the data received about the Equipment into Transportation and Global Trade Management.
curl -u username:password -X PATCH -H "Content-Type:application/vnd.oracle.resource+json; type=singular"
-d '{
    "ownerName": "OWNER NAME",
    "equipMaxGrossWt": {
        "value": 555,
        "unit": "LB"
    },
    "dateBuilt": {
        "value": "2018-09-17"
    },
    "purchDate": {
        "value": "2018-09-17"
    },
    "umCharge": {
        "value": 10000,
        "currency": "USD"
    },
    "umChargeUnit": {
        "value": 1001,
        "unit": "MI"
    },
    "registrationNum": "REGIS NUMBER",
    "registrationDate": {
        "value": "2018-09-21"
    },
}'
https://servername.us2.oraclecloud.com/logisticsRestApi/resources/v2/equipments/{equipmentGid}

DELETE the equipment

Before you get to use the equipment, the rail carrier informs you that this equipment is no longer available and cannot be used. You need to delete it. This will delete the equipment you created and updated above.
curl -u username:password -X DELETE https://servername.us2.oraclecloud.com/logisticsRestApi/resources/v2/equipments/{equipmentGid}