I am trying to update an incident through post man but i have got this error on response "Requested URI does not represent any resource"

Naga19
Tera Contributor

Hi Guys, 

I am trying to updating an incident by hitting the endpoint through post man but i got an error "Requested URI does not represent any resource"

Please refer the screenshot as below.

find_real_file.png

Could you please try to help update an incident with script. 

Please let us know if you need more information. 

 

Thank you 

 

4 REPLIES 4

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

Please check your Scripted Rest API and in that you can see the Resources in Related list.

Open the Resources and from there check the Resource path is same as you given in the Postman and check the HTTP Method as well.

URL should be -

https://instancename/Resourcepath

 

Thanks,

Namrata

Thanks for your response, i have checked the resource path same which is have mentioned in the postman, Could you please provide any script to update an incident so that will be helpful for me

 

Regards

Naga

Hello,

Add the below Script in Resource of your Scripted Rest API and from the Postman in the Body section pass the payload like below:

{

"incident_number":"INC0010981",

"short_description":"test"

}

and in URL section of postman don't pass the incident number just write like below URL

https://instancename/api/API namespace/API ID

var responseBody={};
	var content=request.body.data;
	var incnumber=content.incident_number;
	var sdesc=content.short_description;
	var grinc=new GlideRecord('incident');
	grinc.addQuery('number',incnumber);
	grinc.query();
	if(grinc.next())
		{
			grinc.short_description=sdesc;
			grinc.update();
		}
	responseBody.message="Incident is updated";
	response.setStatus(200);
	response.setBody(responseBody);

Thanks,

Namrata

SumanthDosapati
Mega Sage
Mega Sage

Hi,

Looks like the given endpoint is wrong. Check it once again.

Or else the user credentials used dont pass the READ ACL of incident.

 

Regards,
Sumanth