Utilizing the results of an API to build an array as an input for a second API call

I've been tasked with connecting our Klipfolio dashboard to our Order fulfilment system to display metrics related to our progress. However, the API has some limitations, and I need to effectively do the following:

SOAP API connection 1: Extracts a list of orders by status (https://orderfulfilment.com/api/orders.asmx/ListByStatus?status=unfulfilled)

> This will return back a list of order numbers with the status of "unfulfilled"

SOAP API connection 2: Extract details of the orders from the list of orders extract in API connection 1 (https://orderfulfilment.com/api/orders.asmx/RetrieveOrders?id={order list array})

> This will return back the details of all orders with the status of "unfulfilled"

How do I define the array of order numbers in the URL for the API connection 2 based on the results of the first call?

1 comment

  • 0
    Josh Cohen-Collier

    Hi Marcus,

    Great question!

    This would involve setting up two different datasources, with the second one being dynamic.

    The first datasource would just be the first API call, to get the list of unfulfilled orders.
    The second datasource would be the order details, where the id is a klipfolio variable(eg dynamic).

    If you can pass in more than one value for the ID at a time for that query(eg id=1,2,3,4) then you can simply accomplish this inside of the Klip Editor using the SET function.
         JOIN(ids from first datasource),
         details from second datasource

    Otherwise if you need to pass in IDs one at a time, we can use the MAP function;
          list of ids from first datasource,
          details from second datasource

    Hope this helps!

    Best regards,

Please sign in to leave a comment.