More about JSON Imports
The Worklist Import Web API accepts a JSON string representing the data to be imported. This must be in the following format:
{ "objectName": [ JSON array of data ] }
The Example JSON String
To configure an import, you must have an example JSON string representing the data that you wish to import.
For example, let’s say you want to import data in the following structure into the INTERACTION_X table:
Forename | Surname | Date of Birth | Phone Number | |
---|---|---|---|---|
Bob | Smith | 30 Oct 1977 | 01214960538 | bobs@example.com |
Andrea | Jones | 13 Jan 1985 | 02896496323 | andreaj@example.com |
The JSON string would look like this:
{
"data": [
{ "Forename": "Bob", "Surname": "Smith", "Date Of Birth": "1977-10-30", "Phone Number": "01214960538", "Email": "bobs@example.com" },
{ "Forename": "Andrea", "Surname": "Jones", "Date Of Birth": "1985-01-13", "Phone Number": "02896496323", "Email": "andreaj@example.com" }
]
}
You would paste this JSON into the Import from Json string box in step 1 of Adding an Import.
Syntelate Studio’s Auto Mapping functionality automatically maps keys in your JSON to fields in the INTERACTION_X table, where their names match. As such, we could edit the above JSON to replace “Phone number” with, say, either “LKTL_PHONENUMBER” or “LKTL_NEXTDIALNUMBER”.
{
"data": [
{ "Forename":"Bob", "Surname":"Smith", "Date Of Birth":"1977-10-30", "LKTL_PHONENUMBER":"01214960538", "Email":"bobs@example.com" },
{ "Forename":"Andrea", "Surname":"Jones", "Date Of Birth":"1985-01-13", "LKTL_PHONENUMBER":"02896496323", "Email":"andreaj@example.com" }
]
}
Calling the Worklist Import Web API
To import data, make a POST request to https://serverurl/api/worklist.
The POST must provide the following JSON object in the body of the request.
Name | Description |
---|---|
ImportNumber
|
The number of the import that has been configured to import this data. This number is shown in Syntelate Studio in the list of imports for a particular INTERACTION_X table. To see it, click Show details for the import. |
ApiKey
|
Your authentication key, provided to you by Inisoft. |
ImportData
|
A JSON string containing the data to import. |
For the example given earlier, the JSON object would look as so:
{ 'ImportNumber' : '1',
'ApiKey' : 'xxx',
'ImportData': '{ "data": [
{ "Forename":"Bob", "Surname":"Smith", "Date Of Birth":"1977-10-30", "LKTL_PHONENUMBER":"01214960538", "Email":"bobs@example.com" },
{ "Forename":"Andrea", "Surname":"Jones", "Date Of Birth":"1985-01-13", "LKTL_PHONENUMBER":"02896496323", "Email":"andreaj@example.com" }
] }'
}
Since a large number of records can be inserted in a single call to the Worklist Import Web API, data is added to an import queue.
The call will return the following JSON object result.
Name | Description |
---|---|
Success
|
True/False |
ErrorMsg
|
A string containing the error message. |
QueueId
|
ID of the queue object. |
RecordCount
|
The number of records to be imported. |
Checking the Import Status
You can check the status of an import by making a GET request to https://serverurl/api/worklist/x, where x is the QueueId
that was returned by the POST request.
The call will return the following JSON object result.
Name | Description |
---|---|
Status
|
PENDING/ERROR/SUCCESS |
ErrorMsg
|
A string containing the error message. |
RecordCount
|
The number of records in this import. |
ImportCount
|
The number of records imported so far. |
Note: When configuring the import in Syntelate Studio, you can also set up emails to be sent whenever an import is successful and/or whenever it fails. For more information, see Managing Import Emails.