# Lookup Tables

Use the endpoints below to manage lookup tables programmatically.

# Quick reference

Type Resource Description
GET /api/managed_users/:managed_user_id/lookup_tables Lists tables.
GET /api/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/lookup Lookup row
GET /api/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows List rows
POST /api/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows Add row
PUT /api/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows/:row_id Update row
DELETE /api/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows/:row_id Delete row
GET /api/managed_users/:managed_user_id/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/managed_users/:managed_user_id/lookup_tables

# URL Parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.

# Query 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/managed_users/157/lookup_tables' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/json' \

# Response

{
  "result": [
    {
      "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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
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/managed_users/157/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/managed_users/157/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

{
       "result": [
            {
              "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

{
       "result": [
            {
              "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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
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/managed_users/157/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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
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/managed_users/157/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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
lookup_table_id integer
required
Lookup table id
row_id integer
required
Row id

# Sample request

curl  -X GET https://www.workato.com/api/managed_users/157/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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/lookup

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
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/managed_users/157/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/managed_users/:managed_user_id/lookup_tables/:lookup_table_id/rows/:row_id

# URL parameters

Name Type Description
managed_user_id string
required
Workato Embedded customer Account ID/External ID.
External ID must be prefixed with an E(eg: EA2300) and the resulting ID should be URL encoded.
lookup_table_id integer
required
Lookup table id
row_id integer
required
Row id

# Sample request

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

# Response

{
  "success": true
}