How to make a patch call to external API from Lithium?
Hi,
I need to update an existing record in salesforce by making a patch call from LIthium to salesforce. But Lithium is not allowing me to make Patch call.
Request looks as below :
http.client.request("https","api.something.com","url.something").header("Authorization", "Basic encodedcreds").body("{'param1':'value1','param2':'value2'}","application/json").patch() />
But I'm getting below error says step after the last dot that caused this error. Step after the last dot is patch.
{ "status": "error",%s"error":" FreeMarker template error: The following has evaluated to null or missing: ==>http.client.request("https","api.something.com","url.something").
header("Authorization", "Basic encodedcreds").
body("{'param1':'value1','param2':'value2'}","application/json").patch() /> [in template "sfescalatecasedetails.ftl" at line 2, column 31] ---- Tip: It's the step after the last dot that caused this error, not those before it. ----
So it looks like lithium allows POST method not Patch method.
So I have tried directly calling salesforce API from code instead of creating an endpoint in Lithium, It is working but I'm getting the below error message on console:
Access to XMLHttpRequest at 'https://powerschool--full.my.salesforce.com/services/data/v34.0/sobjects/Case/' from origin 'https://staging.help.powerschool.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Could some one provide me with the solution how to make a patch call to salesforce via Lithium endpoint?
Thanks,
Jhansi