Lookup Table Integration
The following Lookup Table Integration APIs are available:
POST pub/lookupTable
LookupTable - Post
The LookupTable endpoint allows you to create the definition of a lookupTable.
Release Added: 6.4.0
Resource
POST /pub/lookupTable
Authorization
Basic access authentication
Post Parameters
Name |
Type |
Description |
---|---|---|
name | string | The lookup table name. |
description | string | Description of the lookup table. |
custID (optional) | integer | The Organization ID: id of the organization on which to create the lookup table. To retrieve this ID, navigate to ADMIN > Setup > Organizations, and refer to the ID column. |
columnList[] | array | The list of column definitions of the lookup table. |
columnList[].key | boolean | Whether the primary column is key. |
columnList[].name | string | The column name. |
columnList[].type | string | The column type, which can be STRING, LONG, or DOUBLE |
Example
{ "name": "csurl_scores", "description": "", "organizationName": "Super", "columnList": [ { "key": true, "name": "url", "type": "STRING" }, { "key": false, "name": "wfCategoryID", "type": "LONG" }, { "key": false, "name": "score", "type": "DOUBLE" } ] }
Response
Status-Code: 200 OK
{ "id": 1250451, "name": "csurl_scores", "description": "", "organizationName": "Super", "columnList": [ { "key": true, "name": "url", "type": "STRING" }, { "key": false, "name": "wfCategoryID", "type": "LONG" }, { "key": false, "name": "score", "type": "DOUBLE" } ] }
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |
GET pub/lookup Table
LookupTable - Get
The LookupTable endpoint lets you retrieve the list of lookupTable definitions.
Release Added: 6.4.0
Resource
GET /pub/lookupTable
Authorization
Basic access authentication
Query Parameters
Name |
Type |
Description |
---|---|---|
status (optional) | integer | Offset the list of returned results by this amount. Default is zero. |
size (optional) | integer | Number of items to retrieve. Default is 25, maximum is 1000. |
Example Request
Replace <credentials> in the example below with the Base64 encoding of username and password joined by a single colon :
curl -H 'Authorization: Basic <credentials>' \ -H 'content-type: application/json' \ 'https://<IP>/phoenix/rest/pub/lookupTable'
Response
Status-Code: 200 OK
{ "data": [ { "columnList": [ { "key": true, "name": "url", "type": "STRING" }, { "key": false, "name": "wfCategoryID", "type": "LONG" }, { "key": false, "name": "score", "type": "DOUBLE" } ], "organizationName": "Super", "description": "", "id": 1250451, "lastUpdated": 1632432976253, "lastUpdatedResult": "importDataViaFile : 24181 rows are imported successful.", "name": "csurl_scores" } ], "total": 1, "start": 0, "size": 25 }
Request Parameters
Name |
Type |
Description |
---|---|---|
total | string | Total number of items. |
start | integer | Position in pagination. |
size | integer | Number of items to retrieve. |
data | array | An array of lookup Table definition. |
data[].id | integer | The lookup Table ID. |
data[].organizationName | integer | The organization name. |
data[].name | string | The lookup Table name. |
data[].description | string | The description of the lookup Table. |
data[].lastUpdated |
integer |
Unix timestamp when the last update of the lookup Table content occurred. |
data[].lastUpdatedResult |
string |
The result of the last updated lookup Table content. |
data[].columnList[] |
array |
The list of column definitions of the lookup Table. |
data[].columnList[].key |
boolean |
Whether it is the primary column key. |
data[].columnList[].name |
string |
The column name. |
data[].columnList[].type |
string |
The column type, which can be STRING, LONG, or DOUBLE. |
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |
DELETE pub/lookupTable/{lookupTableId}
LookupTable - Delete
The LookupTable endpoint allows you to delete the lookupTable definition.
Release Added: 6.4.0
Resource
DELETE /pub/lookupTable/{lookupTableId}
Authorization
Basic access authentication
Path Parameters
Name |
Type |
Description |
---|---|---|
lookupTableId | integer | Unique identifier representing the lookup Table. |
Query Parameters
None
Example Request
curl -H 'Authorization: Basic <credentials>' \ -H 'content-type: application/json' \ -X DELETE \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>'
Response
Status-Code: 204 No Content
POST pub/lookupTable/{lookupTableId}/import
LookupTable import data - Post
The LookupTable endpoint allows importing the data of lookupTable.
Release Added: 6.4.0
Resource
POST /pub/lookupTable/{lookupTableId}/import
Authorization
Basic access authentication
Post Parameters
Content-Type: multipart/form-data
Name |
Type |
Description |
---|---|---|
file | file | CSV file. |
mapping | string | The configuration matches the position of columns in the CSV file to columns in lookup Table. Format as below: { "<LookupTable_Column_Name_1>":<Position_1>, "<LookupTable_Column_Name_2>":<Position_2>, …… } <LookupTable_Column_Name_1>: string <Position>: integer (from 1) { "url":1, "wfCategoryID":2 } |
fileSeparator (optional) | string | The csv file separator. Default is the comma character, “,”. |
fileQuoteChar (optional) | string | The csv file quote character. Default is the double quotation character, “””. |
skipHeader (optional) | boolean | Whether to ignore the csv file header. Default is false. |
updateType (optional) | string | Data update type. Either “Overwrite” or “Append”. Default is “Overwrite”. |
Example Request
curl -H 'Authorization: Basic <credentials>' \ -X POST \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>/import' -F 'file=@"/<FileDir>/<FileName>.csv"' \ -F 'mapping="{\"url\":1,\"wfCategoryID\":2}"' \ -F 'fileSeparator=","' \ -F 'fileQuoteChar="\""' \ -F 'skipHeader="true"'
Response
Content-Type: application/json
Status-Code: 200 OK
{ "taskId": 1250 }
Name |
Type |
Description |
---|---|---|
taskId | long | The task id of importing data to the lookupTable. |
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |
GET pub/lookupTable/{lookupTableId}/task/{taskId}
LookupTable check importing task status - Get
The LookupTable endpoint allows checking the status of import data.
Release Added: 6.4.0
Resource
GET /pub/lookupTable/{lookupTableId}/task/{taskId}
Authorization
Basic access authentication
Path Parameters
Name |
Type |
Description |
---|---|---|
lookupTableId | integer | The lookup Table Id. |
taskId | integer | The task id of the importing data to the lookup Table. It is retrieved from the Import API response. |
Example Request
Replace <credentials> in the example below with the Base64 encoding of username and password joined by a single colon :
curl -H 'Authorization: Basic <credentials>' \ -H 'content-type: application/json' \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>/task/<taskId>'
Response
Status-Code: 200 OK
{ "id": 1250 "status": "Done", "progress": 100, "actionResult": "557 rows are imported successful." }
Name |
Type |
Description |
---|---|---|
id | integer | The id of task. |
status | string | The status of task. |
progress | integer | The progress of task. |
actionResult | string | The action result of import data task. |
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
GET pub/lookupTable/{lookupTableId}/data
Query LookupTable Data - Get
The LookupTable endpoint allows retrieving items of lookupTable.
Release Added: 6.4.0
Resource
GET /pub/lookupTable/{lookupTableId}/data
Authorization
Basic access authentication
Query Parameters
Name |
Type |
Description |
---|---|---|
start (optional) | integer | Offset the list of returned results by this amount. Default is zero. |
size (optional) | integer | Number of items to retrieve. Default is 25, maximum is 1000. |
searchText (optional) | string | Search text. |
sortBy (optional) | string | Sorted by one of lookupTable columns with descending order. Format: <ColumnName><A blank space><ACS or DESC for ascending or descending order respectively> |
Example Request
Replace <credentials> in the example below with the Base64 encoding of username and password joined by a single colon :
curl -H 'Authorization: Basic <credentials>' \ -H 'content-type: application/json' \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>/data?size=25&start=0&searchText=example&sortBy=score%20acs>'
Response
Status-Code: 200 OK
{ "data": [ { "url": "http://example.com", "wfCategoryID": 26, "score": 0.20050119 }, { "url": "http://www.sample.com/wp-login.php", "wfCategoryID": 26, "score": 0.25293878 }, { "url": "http://www.instance.com/case1", "wfCategoryID": 26, "score": 0.25635383 }, { "url": "http://www.instance.com/case2", "wfCategoryID": 26, "score": 0.25635383 } ], "total": 4, "start": 0, "size": 25 }
Name | Type | Description |
---|---|---|
total | string | Total number of items. |
start | integer | Position in pagination. |
size | integer | Number of items to retrieve (1000 max). |
data | array | An array of lookup Table items. Each item is a dictionary which contains lookupTable column name and its value. |
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |
PUT pub/lookupTable/{lookupTableId}/data
Update LookupTable Data - PUT
The LookupTable endpoint allows updating the item of lookupTable.
Release Added: 6.4.0
Resource
PUT /pub/lookupTable/{lookupTableId}/data
Authorization
Basic access authentication
Path Parameters
Name |
Type |
Description |
---|---|---|
lookupTableId | integer | Unique identifier representing the lookup Table. |
Query Parameters
Name |
Type |
Description |
---|---|---|
key | map |
The primary key of item column and its value. Format: {“<keyColumn_1>”:<value>} key={"url":"http://example.com"} |
Example Request
Replace <credentials> in the example below with the Base64 encoding of username and password joined by a single colon :
curl -g -H 'Content-Type: application/json' \ -H 'Authorization: Basic <credentials>' \ -X PUT \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>/data?key={%22url%22:%20%22http://example.com%22}' \ --data-raw \ '{ "url": "www.test.com", "wfCategoryID": 30, "score": 0.50119 }'
PUT Body
{ "url": "http://test.com" "wfCategoryID": 30, "score": 0.50119 }
Name |
Type |
Description |
---|---|---|
<LookupTableColumnName> | string | Column name. |
<value> |
string, integer, double |
Value. |
Response
Status-Code: 200 OK
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |
PUT pub/lookupTable/{lookupTableId}/data/delete
Delete LookupTable Data- PUT
The LookupTable endpoint allows deleting the lookupTable item.
Release Added: 6.4.0
Resource
PUT /pub/lookupTable/{lookupTableId}/data/delete
Authorization
Basic access authentication
Path Parameters
Name |
Type |
Description |
---|---|---|
lookupTableId | integer | Unique identifier representing the lookup Table. |
Post Parameters
Name |
Type |
Description |
---|---|---|
<array> | list | List of primary key and value map. |
<map> | map | The primary key of item column and its value.
Format: {“<keyColumn_1>”:<value>}
{"url":"http://example.com"} |
Example Request
curl -g -H 'Content-Type: application/json' \ -H 'Authorization: Basic <credentials>' \ -X PUT \ 'https://<IP>/phoenix/rest/pub/lookupTable/<lookupTableId>/data/delete' \ --data-raw \ '[ { "url": "http://www.sample.com/wp-login.php" }, { "url": "http://www.instance.com/case1" }, { "url": "http://www.sample.com/case2" } ]'
Response
Status-Code: 204 No Content
HTTP Error Codes
HTTP Status |
Code |
Description |
---|---|---|
401 | unauthorized |
The bearer credential is invalid. |
400 | bad request |
The request made is incorrect or corrupt. |
422 | missing parameters |
Parameters are missing in query/request body. |
423 | invalid parameters |
The parameters are invalid in path/query/request body. |