Using imports with REST API
The REST API is a charged module. Please contact PICS sales team to arrange access.
The /imports endpoint can be used to sent data through one of the PICS Importers. This will be sent as:
A type, indicating the type of record to be imported.
A list of fields, matching the relevant import specifications, to populate the record.
General
The table below shows the general details for setting up the /import.
Web Method | Body Data |
---|---|
POST | ImportType ImportData |
Import Type
The ImportType is sent in the body of the request. It will be sent as a numerical value. The table below describes the numerical values that you can send as part of a request and what type of record will be imported. Import specifications are available via Import Specifications.
Request Value | Corresponding Type |
---|---|
0 | Null |
1 | Learner |
2 | Applicant |
3 | Organisation |
Import Fields
As shown in the table above, import specifications for the different import types can be found in the PICS Import Specifications section of the help. For multiple-choice fields, it is possible to use the /System/Settings endpoint to view the possible answers and the codes for them, as seen in the example for title below.
JSON Keys and Value types
The table below shows the JSON Key Name and Value Type needed for the Import Type and Import Data list.
Name | Type | Description |
---|---|---|
ImportType | Integer | This defines the type of record to import - See the list of supported Import Types above. |
ImportData | Comma separated Key Value Pairs | These are the actual data fields to be imported - See the explanation of Import Fields above. |
Importing a Field using Postman
To import the field using Postman:
1. Ensure that the expected Content-Type is set to application/json.
2. Set the request method to POST.
The import data will then be passed to the service in the body of the request. The following code snippet is an example of the correct syntax for importing an Applicants first name surname and title:
Example Import JSON
{
"importType": "Applicant",
"fields": [
{"FieldName":"APP_FIRSTNAMES", "FieldValue": "Joe"},
{"FieldName":"APP_SURNAME", "FieldValue": "Bloggs"},
{"FieldName":"APP_TITLE", "FieldValue": "1"}
]
}