- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 03:55 AM
hi all,
i am using this script to creat aincident. and after test it then this error show.
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// implement resource here
var req = request.body.data;
var category = req.category;
var subCat = req.subCategory;
var caller = req.caller;
var sd = req.short_description;
var desc = req.description;
var impact = req.impact;
var urgent = req.urgency;
var gr = new GlideRecord('incident');
gr.initialize();
gr.caller_id = caller;
gr.short_description = sd;
gr.description = desc;
gr.impact = impact;
gr.urgency = urgent;
gr.category = category;
gr.sub_category = subCat;
var id = gr.insert();
var res= {id : id};
response.res=res;
})(request, response);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 04:12 AM
Hi @angel kumari ,
There is a problem with the username and password. Can you check the credentials and try?
Regards,
RJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 05:41 AM
Hi @angel kumari ,
It seems you are getting 401 error code as response output,
401 | Unauthorized. The user credentials are incorrect or have not been passed. |
Please verify that you are using correct username and password from respective servicenow instance, additionally that user should have proper role to create an incident record, you can try with giving "itil" role to that sys_user record.
I hope this solves your issue
Mark this as Helpful / Accept the Solution if this clears your issue
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 04:12 AM
Hi @angel kumari ,
There is a problem with the username and password. Can you check the credentials and try?
Regards,
RJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 06:00 AM
yes i m using mu user as admin or pwosd which is there but again shows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 06:06 AM
@angel kumari Ideally we used to use service accounts for the integration with required permissions.
Regards,
RJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 09:47 AM
hi
why this error show on testing when i pass the value as in contect.
{
"error": {
"message": "com.glide.rest.util.RESTRuntimeException: The payload is not valid JSON.",
"detail": ""
},
"status": "failure"
}