You need to sign in to do that
Don't have an account?
Gage Staruch
How to receive information from an API to populate fields in SF?
I'm trying to sync information from our email marketing tool into Salesforce using their API (https://api.ontraport.com).
My issue is not knowing how to have Salesforce retrieve this information and what to do with the information. Ideally, we'd like to be able to place this info into separate fields automatically.
How do I start with this? I have never used API this way
My issue is not knowing how to have Salesforce retrieve this information and what to do with the information. Ideally, we'd like to be able to place this info into separate fields automatically.
How do I start with this? I have never used API this way
You will have to make an Http callout to the REST API you want from an Apex class and then when you get the response in Json format just parse it and store in whatever fields you want in Salesforce. You can refer to the example given below on how to make a callout.
HttpRequest req = new HttpRequest();
req.setEndpoint('XXXX');
req.setHeader('XX', 'XX ');
req.setHeader('Content-Type','application/json');
req.setMethod('POST');
req.setBody('{"product": {"title": "Burton Custom Freestyle 151 1","body_html": "<strong>Good snowboard!</strong>","vendor": "Burton","product_type": "Snowboard","variants": [ {"option1": "First","price": "10.00","sku": "123"}],"images": [{"src": "https://cdn.shopify.com/assets/images/logos/shopify-bag.png"}],"published": false}}');
Http http = new Http();
HttpResponse res = http.send(req);
System.debug('Body = '+res.getBody());
System.debug('Status = '+res);