unable to update the data in RITM fields using rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2022 07:38 AM
hi
below is the script i developed in scripted rest api using "PUT" Method
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var obj = {};
obj.number = request.pathParams.number;
obj.short_description = request.pathParams.short_description;
obj.description = request.pathParams.description;
var gr = new GlideRecord("sc_req_item");
gr.addQuery("number", obj.number);
gr.query();
if (gr.next()) {
gr.short_description = obj.short_description;
gr.description = obj.description;
gr.update();
response.setBody(obj);
}
})(request, response);
but the script not working if i send the data like below format. can any one help me on this
{failed: True, msg: template error while templating string: expected token 'end of print statement', got 'tf_templates_path'. String: {{ 2tf_templates_path }}/{{ cloud_platform_name }}/{{ tf_backend_file }}.j2, _ansible_no_log: False}
response:
{
"error": {
"detail": null,
"message": "Requested URI does not represent any resource"
},
"status": "failure"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2022 01:05 AM
Hello Rama,
In the Scripted Rest Resource of Rest API add below line in a Relative path
/{number}/{short_description}/{description}
and give the number, short_description, description from the REST API Explorer
Please mark my answer as helpful/correct if it helps you.
Thanks,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2022 06:07 AM