Hi Guys,
I was wondering if anyone could help me, I’m looking to query the DataMapping REST API service to run data through a DataMapping configuration without executing an All-In-One which would subsequently error.
Regardless of where I seem to load datamappers/data, etc, I get the repsonse;
Result: There was an error processing the JSON string caused by: The JSON configuration string is empty. (SRV000090) (SRV000081)
I am fairly new to calling APIs, would anyone be kind enough to point me in the right direction?
// REST API CALL TO MAPPER SERVICE //
var dataMapperId = “cpsdatamapper.OL-datamapper”;
var dataFileId, operationId, fileContent;
var xhr = new ActiveXObject(“Microsoft.XMLHTTP”)var bs = new ActiveXObject("Adodb.Stream"); bs.Type = 1; bs.Open(); bs.LoadFromFile(Watch.ExpandString("%F")); fileContent = bs.Read; bs.Close();
//Upload data config url = "http://localhost:9340/rest/serverengine/filestore/DataFile?persistent=false"; xhr.open("POST", url, false); xhr.setrequestHeader("Content-Type","application/octet-stream"); xhr.send(fileContent); dataFileId = xhr.ResponseText; //Validate data against mapper url = "http://localhost:9340/rest/serverengine/workflow/datamining/" + dataMapperId + "/" + dataFileId + "?validate=true"; xhr.open("POST", url, false); xhr.setrequestHeader("Content-Type","application/json"); xhr.send(); operationId = xhr.getResponseHeader("operationId"); //Get result url = "http://localhost:9340/rest/serverengine/workflow/datamining/getResult/" + operationId; xhr.open("POST", url, false); xhr.setrequestHeader("Content-Type","application/json"); xhr.send(); Watch.Log("URL: " + url, 1); Watch.Log("Result: " + xhr.responseText, 1); //Watch.Log("Result: " + JSON.parse(xhr.responseText).result, 1);