You need to sign in to do that
Don't have an account?
richfer_
How to call a external REST api in apex?
I've to make a call to a external REST api from the apex code. Here is the api,
curl https://website.com/v1/customer/searchbyid/<customer_id> -H 'Content-Type: application/json' -H 'Authorization: APIKey'
I would like to call the api and access the returned values in my controller.
curl https://website.com/v1/customer/searchbyid/<customer_id> -H 'Content-Type: application/json' -H 'Authorization: APIKey'
I would like to call the api and access the returned values in my controller.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_http_httprequest.htm#apex_classes_restful_http_httprequest
for Json, you can set following in the request
req.setHeader('Content-type','application/json');
req.setHeader('Accept','application/json');