- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 07:03 PM
Hi,
I'm using this data loader in Data Source, I wonder if data retrieve from API has status code != 200 like in my code. How can I make whole import set state as 'Completed with errors' instead of 'Cancelled'.
var response = restMessage.execute();
var statusCode = response.getStatusCode();
if (statusCode == 200) {
var body = JSON.parse(response.getBody());
body.forEach(function(e) {
import_set_table.insert(e);
});
} else {
gs.log("Status Code: " + statusCode);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:38 PM
okay, now I got your point.
You could an onStart script to check the connection and abort if required before it comes to the transformation.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 09:29 PM
it seems you never have retrieved any data, right? If so make first sure you can retrieve any data and then start the import again.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:34 PM
Hi @Maik Skoddow, The API returns JSON data like I expected but I need to add exception like when data information send to server is incorrect or server is down for maintenance then my instance would receive status code like 500 or 400 from the server. I wonder if I can stop the current import set in the 'else' clause and set the state of that transform histories (sys_import_set_run) as "Complete as errors" in the my if else condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:38 PM
okay, now I got your point.
You could an onStart script to check the connection and abort if required before it comes to the transformation.
Maik