You need to sign in to do that
Don't have an account?
enossir
Send field data over API Callout
https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_rest_callouts?trail_id=force_com_dev_intermediate
Looking at this....i see you can hardcode text to send to an external service but i need to send field data.
Basically i have a lightning component, as a button. User clicks the button and it takes a field from the current record and is supposed to send that to a third party service......So instead of sending
Straight text like it does here, how do i send the text of a field.
Looking at this....i see you can hardcode text to send to an external service but i need to send field data.
Basically i have a lightning component, as a button. User clicks the button and it takes a field from the current record and is supposed to send that to a third party service......So instead of sending
Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals'); request.setMethod('POST'); request.setHeader('Content-Type', 'application/json;charset=UTF-8'); // Set the body as a JSON object request.setBody('{"name":"mighty moose"}'); HttpResponse response = http.send(request); // Parse the JSON response if (response.getStatusCode() != 201) { System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus()); } else { System.debug(response.getBody()); }
Straight text like it does here, how do i send the text of a field.
We can form the json and include that in the setBody. Thanks,
Govindaraj.S