PATCH Method in REST API

Requirement: Adeptia Suite supports REST methods, such as GET, POST, PUT, and DELETE. However, if there is a request for PATCH in Adeptia, then how does Adeptia handle it via REST API?

For example, client needs this in Salesforce REST API as it only accepts PATCH method to update a record in Salesforce. But, Salesforce's REST API does not allow any other method for updating the record.

Solution: User can do this by using the attached Custom plugin code. In this custom plugin, user can access the Rest URL and body in two ways explained in following two cases:

Case1: If the Payload is defined as below:-


"Comments" : "Test SAP37" 
}

then you need to hard-code the following fields:-

String url = "REST URL";
String body = "{\"Comments\" : \"Test SAP39\"}";


Case2: If the value of REST URL and body are dynamic:-

The user needs to set these variables in process flow context and fetch the value in Custom plugin code using context.get() method. Below is a sample code snippet:-

String url = (String)context.get("URL");

where URL is defined as Process flow variable with value as "REST URL" which you have given by Salesforce.

 

Attached the custom plugin code (CP_PatchOperation.java) for Patch Method.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.