This REST API can be used to import configuration files into the Estate Manager. File imports can be done either synchronously or asynchronously through this API. The asynchronous file import will be done using a scheduled job where a new scheduled job will be created, and its’ job reference will be returned as the response. The synchronous file import will return the number of records imported, as the response.
Request URL #
1POST {Enactor Rest API Base URL}/rest/configuration/import/<filename>?async=true
ex: Enactor Rest API Base URL – http://<Leader IP>:<EMS Port>/WebRestApi/
Request Headers #
Parameter | Accepted values | Remarks |
---|---|---|
Authorization | String | Base64 encoded userName:password with “Basic”Ex: Basic aW5zdGFsbDppbnN0YWxs |
Content-Type | application/zipapplication/xml | |
Content-MD5 | String | Optional.MD5 checksum of the file we are importing.If specified, file’s checksum will be compared against the parameter value and reject the request if checksum fails.If not specified, checksum verification will be skipped. |
x-enactor-default-user-password | String | Optional.Only applicable when importing User entities.If specified, all the passwords of imported user entities will be set to this. |
x-enactor-connection-process-id | String | Optional.Defaults to “RetailProcessServer” |
x-enactor-connection-point-id | String | Optional.Defaults to “RetailServerJobResults” |
x-enactor-runtime-context | String | Optional.Defaults to “Enactor Web Retail Processing” |
Query parameters #
Parameter | Accepted values | Remarks |
---|---|---|
async | true / false | File import will be done asynchronously if trueFile import will be done synchronously if falsedefault false |
Path parameters #
Parameter | Accepted values | Remarks |
---|---|---|
<filename> | String | The path the file should be saved inside the file repository.Be mindful to use the correct extension as the file import processor will be determined on that. |
Request Body #
The body should be the Enactor configuration file as a stream.
Response Body #
If the request is asynchronous, the response will be the scheduled job reference number as shown below.
{
jobReference: 1
}
If the request is synchronous, the response will be the number of imported records as shown below.
{
recordsImported: 10
}
Status Code #
Status Code | Status Description | Description |
---|---|---|
200 | Success | The request is successful and will give the above response. |
400 | Bad Request | The request has incorrect request parameters which are not acceptable |
500 | Server Error | Unexpected error occurred while processing the request |
Guide to Integrate #
JavaScript (NodeJS) Example #
const fetch = require('node-fetch');
const fs = require('fs');
const assert = require('assert').strict;
const BASE_URL = "{Enactor Rest API Base URL}/rest/configuration";
fetch(BASE_URL + '/import/configs.zip?async=true', {
method: 'post',
headers: {
'Authorization': 'Basic aW5zdGFsbDppbnN0YWxs',
'Content-Type': 'application/zip',
'Content-MD5': '0b04633be98c35777f72f70d0edde41a',
'x-enactor-default-user-password': 'new_pw'
},
body: fs.createReadStream('standard-data-estateManager-TRUNK-SNAPSHOT.zip')
}).then(res => assert.equal(res.status, 200))
.catch(err => console.log(err.message))