Chaining API

The Chaining API allows you to automate workflows—initiating multiple API actions as a seamless, single request.

You can automate multi-step tasks by combining multiple API calls into one request, eliminating manual intervention after each step. You can assign outputs from one step to variables for use in subsequent steps.

How the Chaining API Works

Submit your workflow steps in a call list, specifying the HTTP verb, endpoint URL, content type, and request body for each. Use variables to capture outputs and feed them into subsequent actions. When referencing variables in API requests, use the $ syntax (e.g., /entity/oblpn/${lpn_id[0]['id']}/ship). If your data contains a $ character, escape it with $$.

Note: Chaining APIs execute the logic for each API internally one after another. While the communication overhead for each call gets reduced since this is just one API call, the overall time taken will roughly be the same. We do not recommend passing “too many” API calls in one chain. What is “too many” will depend on the use case and the customer’s acceptance of the time it takes for that chain. Customers need to determine the right limit for the use case while keeping in mind that having too many calls will slow down the chaining API.

Endpoint

.../lgfapi/v10/chaining/chaining/

Sample Payload

{

    "call_list": [

        {

            "assignment_target": "",

            "verb": "POST",

            "url": "/wms/api/create_lpn/",

            "content_type": "application/x-www-form-urlencoded",

            "body": "lpn_nbr=LPN123&qty=5&facility_code=DC01&item_barcode=ITM101&company_code=C01&xdock_lpn_flg=False"

        },

        {

            "assignment_target": "",

            "verb": "POST",

            "url": "/wms/lgfapi/v10/entity/oblpn/create_from_iblpn/",

            "content_type": "application/json",

            "body": "{     \"fields\": {     \"oblpn\": {     \"facility_id\": 1,             \"company_id\": 1,             \"container_nbr\": \"OBLPN123\",     \"parameters\": {         \"allocations\": [             {                 \"order_nbr\": \"ORDER123\",                 \"order_dtl\": {                     \"seq_nbr\": 1                     },                 \"iblpn_nbr\": \"LPN123\",                 \"qty\": 5            }             ]     },     \"options\":     {         \"pack_flg\": true    } }"

        },

        {

            "assignment_target": "lpn_id",

            "verb": "GET",

            "url": "/wms/lgfapi/v10/entity/oblpn/?container_nbr=OBLPN123&values_list=id",

            "content_type": "application/json"

        },

        {

            "assignment_target": "",

            "verb": "POST",

            "url": "/wms/lgfapi/v10/entity/oblpn/${lpn_id[0]['id']}/ship",

            "content_type": "application/json",

            "body": "{     \"fields\": {       },     \"parameters\": {},     \"options\":     {\"locn_barcode\": \"LOC1135894\" } }"

        }

    ]

}