Articles in this section

Populate a lookup cache with a flow

Use a flow to create and update lookup cache entries when the data isn't in a CSV file, can't be downloaded from the source application, or changes often. An import step sends each record to the lookup cache upsert API as one key-value entry. This procedure is for builders who already created a lookup cache.

Prerequisites:

  • A lookup cache. See Create a lookup cache.
  • The lookup cache ID. Go to Resources Resources icon, and then select Lookup caches. At the end of the lookup cache row, select Actions Actions icon, and then select Edit. Copy the ID from the end of the browser address.
  • A Celigo APIs connection with Full access.

Example flow

The following flow stores inventory data in a lookup cache named Product SKUs:

  1. An export retrieves inventory items from Shopify.
  2. A lookup adds inventory level details, such as location, sku, and threshold, to each record by item_id.
  3. An import creates or updates entries in the Product SKUs lookup cache.

Request body structure

The import sends this structure as the request body of the upsert API, POST /v1/lookupcaches/{_id}/data. All properties are required.

Property Description
data An array of entries.
key A unique string for each entry.
value The data for the key. For allowed types, see Create a lookup cache.
{
  "data": [
    {
      "key": "46451277299909",
      "value": {
        "sku": "111111",
        "location": "Main Shop",
        "threshold": "5"
      }
    }
  ]
}

Add the import step

  1. Go to Build Build icon, and then select Flows.
  2. Open the flow that retrieves the data.
  3. Add an import step that uses the Celigo APIs application, and then select your Celigo APIs connection.
  4. Under How would you like the records imported?, set Option to Invoke Celigo standard resource APIs, Resource to Lookup cache, and API endpoint to Upsert data in a lookup cache.
  5. For Lookup cache ID, enter the lookup cache ID.
  6. Map each source record to one entry in data, using the structure above.
  7. Check that the entries appear in the preview.

If one source record creates more than one entry, the import step returns an error. See Troubleshoot lookup caches.

For other lookup cache API endpoints, see the Lookup caches API reference.