# Lookup Tables

Use the endpoints below to manage lookup tables programmatically.

# Quick reference

Type Resource Description
GET /api/lookup_tables Lists tables.
GET /api/lookup_tables/:lookup_table_id/lookup Lookup row
GET /api/lookup_tables/:lookup_table_id/rows List rows
POST /api/lookup_tables/:lookup_table_id/rows Add row
PUT /api/lookup_tables/:lookup_table_id/rows/:row_id Update row
DELETE /api/lookup_tables/:lookup_table_id/rows/:row_id Delete row
GET /api/lookup_tables/:lookup_table_id/rows/:row_id Get row

# List Lookup Tables

Returns a list of lookup tables belonging to customer account.

GET /api/lookup_tables

# Parameters

Name Type Description
page integer Page number. Defaults to 1.
per_page integer Page size. Defaults to 100 (maximum is 100).

# Sample request

curl  -X GET 'https://www.workato.com/api/lookup_tables' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json' \

# Response

[
  {
    "id": 1315,
    "name": "lookup_table4",
    "schema": "[{\"control_type\":\"text\",\"label\":\"code\",\"name\":\"col1\",\"type\":\"string\",\"sticky\":true},{\"control_type\":\"text\",\"label\":\"name\",\"name\":\"col2\",\"type\":\"string\",\"sticky\":true},{\"control_type\":\"text\",\"label\":\"col3\",\"name\":\"col3\",\"type\":\"string\",\"sticky\":false},{\"control_type\":\"text\",\"label\":\"col4\",\"name\":\"col4\",\"type\":\"string\",\"sticky\":false},{\"control_type\":\"text\",\"label\":\"col5\",\"name\":\"col5\",\"type\":\"string\",\"sticky\":false}]",
    "created_at": "2022-05-20T11:54:26.934-07:00",
    "updated_at": "2022-05-20T11:54:26.934-07:00"
  }
]

# List rows

Returns a lists of rows from the lookup table. Supports filtering and pagination.

GET /api/lookup_tables/:lookup_table_id/rows

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id

# Query parameters

Name Type Description
page integer Page number. Defaults to 1.
per_page integer Page size. Defaults to 500 (maximum is 1000).
by[<col name>] string
Filter criteria. The column name should be provided as follows: by[<col name>]. To match by multiple columns, provide multiple parameters. Refer to the sample request for more details. When not supplied, all rows are returned.

# Sample request

# Request 1: list rows

curl  -X GET https://www.workato.com/api/lookup_tables/1296/rows \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json'

# Request 2: filter and list rows

curl  -X GET https://www.workato.com/api/lookup_tables/1296/rows?by[code]=US \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json'

# Response

# Response 1: list rows

[
      {
        "id": 941,
        "data": {
          "code": "IND",
          "name": "India",
          "col3": null,
          "col4": null,
          "col5": null
        },
        "created_at": "2022-06-15T11:50:32.986-07:00",
        "updated_at": "2022-06-15T11:50:40.986-07:00"
      },
      {
        "id": 942,
        "data": {
          "code": "US",
          "name": "United States",
          "col3": null,
          "col4": null,
          "col5": null
        },
        "created_at": "2022-05-20T11:50:32.986-07:00",
        "updated_at": "2022-05-20T11:50:40.986-07:00"
      }
]      

# Response 2: filter and list rows

[
      {
        "id": 942,
        "data": {
          "code": "US",
          "name": "United States",
          "col3": null,
          "col4": null,
          "col5": null
        },
        "created_at": "2022-05-20T11:50:32.986-07:00",
        "updated_at": "2022-05-20T11:50:40.986-07:00"
      }
]      

# Add row

Adds a row to the lookup table.

POST /api/lookup_tables/:lookup_table_id/rows

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id

# Payload

Name Type Description
data Hash
required
The hash contains the data for the new row.

# Sample request

curl  -X POST https://www.workato.com/api/lookup_tables/1296/rows \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json' \
      -d '{ "data": { "name": "United States", "code": "USA" }}'

# Response

{
  "id": 942,
  "data": {
    "code": "USA",
    "name": "United States",
    "col3": null,
    "col4": null,
    "col5": null
  },
  "created_at": "2022-05-20T11:50:32.986-07:00",
  "updated_at": "2022-05-20T11:50:32.986-07:00"
}

# Update row

Updates a row in the lookup table.

PUT /api/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id
row_id integer
required
Row id

# Payload

Name Type Description
data Hash
required
The hash containing the data for the updated row. Only the columns provided are updated.

# Sample request

curl  -X PUT https://www.workato.com/api/lookup_tables/1296/rows/942 \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json' \
      -d '{ "data": { "code": "US" }}'

# Response

{
  "id": 942,
  "data": {
    "code": "US",
    "name": "United States",
    "col3": null,
    "col4": null,
    "col5": null
  },
  "created_at": "2022-05-20T11:50:32.986-07:00",
  "updated_at": "2022-05-20T11:50:40.986-07:00"
}

# Get row

Gets a row from the lookup table.

GET /api/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id
row_id integer
required
Row id

# Sample request

curl  -X GET https://www.workato.com/api/lookup_tables/1296/rows/942 \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json'

# Response

{
  "id": 942,
  "data": {
    "code": "US",
    "name": "United States",
    "col3": null,
    "col4": null,
    "col5": null
  },
  "created_at": "2022-05-20T11:50:32.986-07:00",
  "updated_at": "2022-05-20T11:50:40.986-07:00"
}

# Lookup row

Finds the first row matching the given criteria in the lookup table. Returns a 404 when the lookup fails.

GET /api/lookup_tables/:lookup_table_id/lookup

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id

# Query parameters

Name Type Description
by[<col name>] string
required
Lookup criteria. The column name should be provided as follows: by[<col name>]. To match by multiple columns, provide multiple parameters. Refer to the sample request for more details.

# Sample request

curl  -X GET https://www.workato.com/api/lookup_tables/1296/rows/942?by[code]=US \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json'

# Response

{
  "id": 942,
  "data": {
    "code": "US",
    "name": "United States",
    "col3": null,
    "col4": null,
    "col5": null
  },
  "created_at": "2022-05-20T11:50:32.986-07:00",
  "updated_at": "2022-05-20T11:50:40.986-07:00"
}

# Delete row

Delete a row from the lookup table

DELETE /api/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
lookup_table_id integer
required
Lookup table id
row_id integer
required
Row id

# Sample request

curl  -X DELETE https://www.workato.com/api/lookup_tables/1296/rows/942 \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json'

# Response

{
  "success": true
}