Integration giving 400 error , when i trigger it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2022 04:12 AM
Hi All,
I have a Business rule from where i am triggering this integartion it is in a "XYZ" scope.
and my rest message is in Global scope ,v i have changed the setting to All scope
This is giving me error. 400
try {
requestBody = {
extra_vars:{
data: {
_cmd: "abc",
hostname: "loncsdx",
database: "testdb01"
}
}
};
strRequestBody = JSON.stringify(requestBody);
sm = new sn_ws.RESTMessageV2("global.testApi", "Post");
sm.setRequestBody(strRequestBody);
sm.setMIDServer(midserver);
sm.setRequestHeader("Content-Type", "application/json");
sm.setEccParameter('skip_sensor', true);
response = sm.execute();
responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
status = response.getStatusCode();
} catch (ex) {
responseBody = ex.getMessage();
status = '500';
} finally {
strRequestBody = sm ? sm.getRequestBody() : null;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2022 04:40 AM
Status 400 means your are most likely not passing a correct payload or failing some validations in target system.
Check if there is any additional message to go with status 400 in the response. Maybe that will provide more context.
What system/API are you connecting to?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2022 04:42 AM
Method failed: (/api/v2/job_templates/66/launch/) with code: 400
I am getting this error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2022 05:45 AM
Hello Priya,
As Tomas said status 400 means your are most likely not passing a correct payload or failing some validations in target system.
But I would to know what response body are you getting after executing it. so I could help you ahead.
BR,
Nayan
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2022 09:35 PM
Method failed: (/api/v2/job_templates/66/launch/) with code: 400
this is i am getting in response