APIs
Bulk Load API
Two API calls are required.
Task |
Call |
URL |
Parameters |
Response |
---|---|---|---|---|
Submit file |
POST |
/api/ uploadfiles/ This URL will be moved to tool/UploadFile in future. |
hierarchy=[hierarchy] Content-Type: multipart/form-data name='uploadedfile' filename=<filename> the file to upload |
{"uploadedfiles": [{"id": "<file_id>", "name": "<filename>"}]} |
The response is HTTP 202
Task |
Call |
URL |
Parameters |
Payload |
---|---|---|---|---|
Bulk Load |
POST |
/api/tool/ BulkLoad/ |
method= bulkload_spreadsheet hierarchy=[hierarchy] |
Examples: {'bulkload_file': '<filename>', 'execute_immediately': true} or: {'bulkload_file': '<filename>', 'execute_immediately': false 'execute_date': '2013-06-20', 'execute_time': '12:00:00', 'execute_timezone': '0'} |
The following curl commands illustrate the two steps:
Step 1
curl -H 'Authorization: Basic <auth_key>' -F uploadedfile="@<file>.xlsx" 'http://<hostname>/api/uploadfiles/'
Step 2
curl -H 'Authorization: Basic <auth_key>' -H 'Content-Type: application/json' -H 'accept: application/json' --data-binary '{"bulkload_file":"DEMO.xlsx","execute_immediately":true}' 'http://<host>/api/tool/BulkLoad/?hierarchy=[hierarchy]& method=bulkload_spreadsheet& nowait=true& format=json'
The response to this call is for example as in the following table.
Response |
---|
{"href": "/api/tool/Transaction/0b340a6f-b658-48bb-ac8c-7562adc5572d", "success": true, "transaction_id": "0b340a6f-b658-48bb-ac8c-7562adc5572d"} |
-
If the Bulk Load is to be scheduled, the payload of the second task includes schedule details:
-
execute_immediately is set to false
-
execute_date is added in the format YYYY-MM-DD
-
execute_time is added in the format HH:MM:SS
-
execute_timezone is added in the format of a numeric value in minutes relative to UTC. For example, UTC is 0, UTC+2:00 is 120, UTC-1:00 is -60, and so on.
-
-
An entry is also generated in the schedule; that is, an instance is added to the data/Schedule module.
-
If the second task payload has 'execute_immediately': true, a POST is generated to /api/data/Bulkload/. The payload includes the uploaded filename and a generated name and time stamp as well as a description, for example:
{'filename': '<file>.xlsx', 'description': 'Generated by Bulk Loader Administration Tools', 'name': 'AnyUser.xlsx -- 2013-05-21 16:47:11.801664 (UTC)'}
To inspect the detailed progress and status of the transaction, use the API call from the response above:
GET /api/tool/Transaction/[pkid]
with parameters:
-
hierarchy=[hierarchy]
-
format=json
The response to this GET call is a JSON object that provides details of the transaction, as for example in the truncated snippet:
... "href": "/api/tool/Transaction/[pkid] "log_id": "53a8053ea616540708141f44", "message": "data_Countries_bulkloadsheet.xlsx is a valid "severity": "info", "time": "2014-06-23T10:45:18.029000", "transaction_id": "[pkid]" } ], "pkid": "[pkid]", "resource": {}, "rolled_back": "No", "started_time": "2014-06-23T10:45:17.813000", "status": "Success", "sub_transactions": [ { "action": "Execute Resource", "detail": "Execute : data_Countries_bulkloadsheet.xlsx -- ... "status": "Success", "submitted_time": "2014-06-23T10:45:19.567000", "transaction": "/api/tool/Transaction/[pkid1] ... }, { "action": "Create Schedule", "detail": "Name:data_Countries_bulkloadsheet.xlsx -- 2014- ... "status": "Success", "submitted_time": "2014-06-23T10:45:18.912000", "transaction": "/api/tool/Transaction/[pkid2] ... }, { "action": "Create Bulk Load", "detail": "Name:data_Countries_bulkloadsheet.xlsx -- 2014-06 ... "status": "Success", "submitted_time": "2014-06-23T10:45:18.419000", "transaction": "/api/tool/Transaction/[pkid3] ... } ], "submitted_time": "2014-06-23T10:45:17.794000",
The same transaction displays on the GUI.
For long transactions, to retrieve a summary of the status of the transaction, the transaction can be polled, using poll in the URL, using the same parameters:
GET /api/tool/Transaction/poll/?transactions=[pkid]
In this case, there is a shortened response, for example:
{"[pkid]": {"status": "Processing", "href": "/api/tool/Transaction/0b340a6f-b658-48bb-ac8c-7562adc5572d", "description": null} }
HCS Intelligent Loader APIs
-
/setup/configuration/{key} Parameter
Description
Value
Method
key
string
GET
-
/setup/configuration Parameter
Description
Value
Method
POST
-
/setup/target/{id} Parameter
Description
Value
Method
Id
Identity value to be selected for the target system
int
GET
-
/setup/target Parameter
Description
Value
Method
POST
-
/validaterService/validate/{hierarchy}/{operation}?modelName &mappingTemplate &srcFilename Parameter
Description
Value
Method
operation
Selected Operation to be performed like Add,etc
string
GET
hierarchy
Cisco Unified Communications Domain Manager Hierarchy under which the validation runs
modelName
Name of the model
srcFileName
Source file Name to be selected for validation
MappingTemplate
mapping Template that is selected for validation
-
/validaterService/getFileStatus?fileName &sheetName &modelName &hierarchy Parameter
Description
Value
Method
fileName
Name of the File for which Validation status is needed
string
GET
sheet Name
Sheet Name that is passed (Optional parameter)
modelName
Name of the model
hierarchy
Cisco Unified Communications Domain Manager Hierarchy under which the File exists
-
/validaterService/fileData?fileName &sheetName &modelName &hierarchy Parameter
Description
Value
Method
fileName
Name of the file to be selected in which sheet exist
string
GET
sheet Name
Sheet Name that is passed as parameter to get its content
modelName
Name of the model
hierarchy
Cisco Unified Communications Domain Manager Hierarchy under which the File exists
-
/validaterService/fileData/{hierarchy}?fileName &sheetName &model Parameter
Description
Value
Method
fileName
Name of the file that is to be saved
string
POST
sheet Name
Sheet Name of the File that is passed as parameter
modelName
Name of the model
hierarchy
Cisco Unified Communications Domain Manager Hierarchy under which the file should be saved
-
/Importexport/DownloadFile?model &hierarchy &filename Parameter
Description
Value
Method
model
Name of the model
string
GET
filename
Name of the Mapping template file to download
hierarchy
Cisco Unified Communications Domain Manager Hierarchy to download the file from
-
/Importexport/UploadFile?selectedModel &selectedHierarchy Parameter
Description
Value
Method
selectedModel
Name of the model
string
POST
selectedHirarchy
Cisco Unified Communications Domain Manager Hierarchy to upload the file
-
/Importexport/CopyFile?Model &Hierarchy &SelectedFileName Parameter
Description
Value
Method
model
Name of the model
string
POST
SelectedFileName
Name of the Mapping template
hierarchy
Cisco Unified Communications Domain Manager Hierarchy to copy the file
-
/Importexport/RenameFile?Model &Hierarchy &SelectedFileName &NewFileName Parameter
Description
Value
Method
Model
Name of the model
string
PUT
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to rename the file
SelectedFileName
Name of the mapping template file
NewFileName
New name of the mapping template file
-
/mappingtemplate Parameter
Description
Value
Method
Model
Name of the model
string
POST
-
/mappingtemplate/listTemplates?selected &model &hierarchy Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy from where file is to be displayed
Selected
Name of the mapping template file
-
/mappingtemplate/listTemplates/{id} Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy from where file is to be displayed
Selected
Name of the mapping template file
-
/Importexport/DownloadFile?model &hierarchy &filename Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to download the file from
Selected
Name of the mapping template file
-
/Importexport/UploadFile?selectedModel &selectedHierarchy Parameter
Description
Value
Method
selectedModel
Name of the model
string
POST
selectedHierarchy
Cisco Unified Communications Domain Manager Hierarchy to upload the file
-
/Importexport/CopyFile?Model &Hierarchy &SelectedFileName Parameter
Description
Value
Method
Model
Name of the model
string
POST
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to copy the file
SelectedFileName
Name of the mapping template file
-
/Importexport/RenameFile?Model &Hierarchy &SelectedFileName &NewFileName Parameter
Description
Value
Method
Model
Name of the model
string
PUT
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to rename the file
SelectedFileName
Name of the mapping template file
NewFileName
New name of the mapping template file
-
/LoaderService/DeleteFile?Model &Hierarchy &SelectedFileName Parameter
Description
Value
Method
Model
Name of the model
string
DELETE
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to delete the file from
SelectedFileName
Name of the uploaded file to delete
-
/LoaderService/DownloadFile?model&hierarchy&filename Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to download the file from
SelectedFileName
Name of the uploaded file to download
-
/LoaderService/UploadFile Parameter
Description
Value
Method
string
POST
-
/LoaderService/ExportFile?Model &Hierarchy &FileName &MappingTemplate Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to export the file from
FileName
Name of the file to export from Cisco Unified Communications Domain Manager
MappingTemplate
Name of the Mapping template to export
-
/LoaderService/listworksheets/{hierarchy}?model &templateID &filename Parameter
Description
Value
Method
hierarchy
Cisco Unified Communications Domain Manager Hierarchy to list out worksheets of the file from
string
POST
model
Name of the model
string
GET
templateID
Name of the mapping template to list work sheet
fileName
Name of the uploaded file to get lists of work sheets
-
/LoaderService/listworksheets/{hierarchy}?model &templateID &filename Parameter
Description
Value
Method
hierarchy
Cisco Unified Communications Domain Manager Hierarchy to list out worksheets of the file from
string
POST
model
Name of the model
string
GET
templateID
Name of the mapping template to list work sheet
fileName
Name of the uploaded file to get lists of work sheets
-
/LoaderService/CopyFile?Model &Hierarchy &SelectedFileName Parameter
Description
Value
Method
model
Name of the model
string
POST
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to copy the file from
SelectedFileName
Name of the uploaded file to make a copy
-
/LoaderService/RenameFile?Model &Hierarchy &SelectedFileName &NewFileName Parameter
Description
Value
Method
Model
Name of the model
string
PUT
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to rename the file from
SelectedFileName
Name of the the uploaded file to rename
MappingTemplate
Name of the new file name to rename
-
/LoaderService/ExportFile?Model &Hierarchy &FileName &MappingTemplate Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to export the file from
FileName
Name of the file to export from Cisco Unified Communications Domain Manager
MappingTemplate
Name of the Mapping template to export
-
/LoaderService/listworksheets/{hierarchy}?model &templateID &filename
-
/LoaderService/CopyFile?Model &Hierarchy &SelectedFileName
-
/LoaderService/RenameFile?Model &Hierarchy &SelectedFileName &NewFileName
-
/LoaderService/loader/{hierarchy}/{operation}?modelName&mappingTemplate &srcFileName Parameter
Description
Value
Method
Operation
Mode of operation Add/Edit/Delete
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to load the file from
modelName
Name of the model
string
POST
srcFileName
Name of the uploaded file to load into Cisco Unified Communications Domain Manager
MappingTemplate
Name of the Mapping template file to load
-
/LoaderService/listFiles?model &hierarchy Parameter
Description
Value
Method
Model
Name of the model
string
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to load the file from
-
/targetResources/query?model_name &onlyFieldNames &hierarchy Parameter
Description
Value
Method
model_name
string
GET
hierarchy
onlyFieldNames
boolean
-
/upload
-
/commonresources
-
/commonresources/hierarchy/{id} Parameter
Description
Value
Method
Id
Identity value, by default 1
int
Default: 1
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to load the file from
-
/commonresources/login
-
/commonresources/menu/{id} Parameter
Description
Value
Method
Id
Identity value, by default 1
int
Default: 1
GET
Hierarchy
Cisco Unified Communications Domain Manager Hierarchy to load the file from
-
/commonresources/issession
-
/commonresources/hillogout
-
/commonresources/logout
-
//commonresources//userinfo