Lookup Table API
- 1 Lookup Tables
- 1.1.1 Implementing API cURLs
- 1.2 List
- 1.3 Create
- 1.4 Individual
- 2 Lookup Table Rows
- 2.1 List
- 2.2 Create
- 2.3 Individual
Lookup Tables
Implementing API cURLs
All URL endpoints should be utilized as part of a cURL authentication command. For more information, please review https://dimagi.atlassian.net/wiki/x/LwXKfw.
List
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table/
Sample output:
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 6
},
"objects": [
{
"fields": [
{
"field_name": "name",
"properties": ["lang"]
},
{
"field_name": "price",
"properties": []
}
],
"id": "bcf49791f7f04f09bd46262097e107f2",
"is_global": true,
"item_attributes": [],
"resource_uri": "",
"tag": "vaccines"
},
....
]
}
Create
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table/
Supported Methods:
Method | Description |
---|---|
POST | Create lookup table |
Input Parameters:
Name | Description |
---|---|
tag* | Lookup table name |
fields* | Fields and their properties for the lookup table to have |
is_global | Boolean if the lookup table is accessible to all users. Default: false |
Returns 201 Created on success
Sample input:
Single Group:
JSON Input
{
"tag": "vaccines",
"fields": [
{"field_name": "name", "properties": ["lang"]},
{"field_name": "price", "properties": []},
],
"is_global": true
}
Individual
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table/[lookup_table id]
Supported Methods:
Method | Description |
---|---|
GET | Get lookup table |
PUT | Edit lookup table |
DELETE | Delete lookup table |
Input Parameters For Editing:
Name | Description |
---|---|
name | Lookup table name |
fields | Fields and their properties for the lookup table to have |
is_global | Boolean if the lookup table is accessible to all users. |
Sample input:
JSON Input
{
"tag": "vaccines",
"fields": [
{"field_name": "name", "properties": ["lang"]},
{"field_name": "price", "properties": []},
]
}
Lookup Table Rows
List
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table_item/
Supported Methods:
Method | Description |
---|---|
GET | List lookup table rows |
Sample output:
Create
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table_item/
Supported Methods:
Method | Description |
---|---|
POST | Create a new lookup table row |
Input Parameters:
Name | Description |
---|---|
data_type_id* | ID of a lookup table |
fields* | Fields and their properties for the lookup table to have |
Returns 201 Created on successful creation
Sample input:
Single row:
JSON Input
Individual
URL: https://www.commcarehq.org/a/[domain]/api/[version]/lookup_table_item/[lookup_table_item id]
Supported Methods:
Method | Description |
---|---|
GET | Get lookup table row |
PUT | Edit lookup table row |
DELETE | Delete lookup table row |
Input Parameters For Editing:
Name | Description |
---|---|
data_type_id* | ID of a lookup table |
fields* | Fields and their properties for the lookup table to have |
Sample input:
JSON Input