Ethan Davies
Mega Sage

Hey VJ,

Take a look at this article here, should contain all you need.

Thanks,

Ethan

Please mark my answer as correct or helpful if it aided in solving your issue.

Ankur Bawiskar
Tera Patron

Hi,

Didn't get completely the use-case

You can use OOB Table API with DELETE method

OR

You can use Scripted REST API with Delete HTTP method

Regards
Ankur

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

PavanK960672992
Mega Patron

Hi,

On Scripted REST API use DELETE HTTP method.

Make the script based on your requirement that is when you need to perform delete operation.

Thanks,

Pavankumar

Sameer18
Tera Contributor

Hello,

I am adding little elaborative answer, I have pasted below code you need to write down code on similar lines.

Note: Instead of passing name in payload you can pass it as path parameter. 

 

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

	var name = request.pathParams.name || null;
	if (!name)
		return new sn_ws_err.BadRequestError("Change Request id not provided");
	
	var result = {};

	var record = new GlideRecord('x_test');
	if(record.get('name', name)){
		if (!record.deleteRecord())
			return new sn_ws_err.BadRequestError("Change Request not deleted");
		else{
			result.status = 'success';
			response.setStatus(200);
			response.setBody(result);
		}
	}else
		return new sn_ws_err.NotFoundError("Change Request not found");

})(request, response);

 

Step1: Create a scripted REST API with proper name (e.g. Test Table APIs )

find_real_file.png

Step 2: Create a DELETE scripted REST Resource  as shown in below screenshot

find_real_file.png