2022-08-15 02:47 PM - edited 2022-08-15 05:02 PM
I am trying to run a data feed Javascript Transport file that will trigger data publications to run via the recently available internal APIs; however, the data feed keep Failing with the message: "The script execution failed due to an un-expected error" (or a similar message). I have tried to include several Try/Catch statements, but have not been able to find where it is erroring.
But the most odd part is that the data publications will run even if the data feed fails. Here is the section of the Javascript that runs the DPS.
function runDataPublication(token, dpsID, callback) {
try {
httpRequest.get(
{
url: "https://localhost.com/RSAarcher/api/V2/internal/DataPublications(" + dpsID + ")/_RunNow",
headers: {
"Content-Type": "application/json;charset=UTF-8",
"Authorization": "Archer session-id=" + token
},
strictSSL: false
}, function (error, response, body) {
if (error) {
callback(error.toString());
}
else if (response.statusCode == 200) {
callback(JSON.parse(body).statusText);
}
else {
callback("There was another error");
}
});
}
catch (err) {
callback("Try-Catcher error received: " + err);
};
};
When I tried to run the same API via the API Template, I receive a 200 status, but also an error at the top of the page. However, this time, it does NOT trigger the DPS.