function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sam AlexSam Alex 

Validate Custom Object Data with another server with CURL

Hi all,

I want to have a special Trigger.

When I am saving data of a custom object my Trigger triggers. At that place I want to send a CURL request to another server and get a response. Response is basically validation.

Based on the validation response I want to display error messege in SalesForce interface.

1. Can I send CURL request with JSON to another server with Apex?
2. Once I get the JSON response can Apex decode it show errors (if available) OR add record in SalesForce side?

Please Help. Thanks.
Gaurav KheterpalGaurav Kheterpal
1. Why do you want do do this via CURL request. Why not a HTTP request?
2. Related to above, if you use HTTP request/ response instead of CURL, you can definitely decode the errors in the response.