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
sashamsasham 

anyone answe pls

It is in Curl for makign Api calout for post method 

curl -H 'Accept: application/xml' -H 'Content-Type:application/xml' \
-u api_key:api_token -d '<message><data><result>
<id>123</id>
<address>cc</address>
<value>5</value>
</result></data></hl7message>'\
'https://example.com/customers/2342/messages

But How do make callout in Apex calss forthe above 
Specially for authentication  -u api_key:api_token
I have api key and token 
Nayana KNayana K
Check this link:
http://www.crmscience.com/single-post/2016/04/15/Apex-for-REST-Integration-Overview-of-the-Callout

I think below is what you are looking into:
 
// Add basic authentication to header
// Create blob of user:pass
Blob headerValue = Blob.valueOf(username + ':' + password);
// Base 64 Encode the blob and prepend "Basic "
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
// Add the basic auth string to the Request Header
req.setHeader('Authorization', authorizationHeader);

 
sashamsasham
Thank you Nayana . I will try this and let you know
I have one meore question 
We need to set up URL  in our end  to receive some kind of notification from external system
For that, we need to authenticate the request 
Could you please let me know if salesforce support HTTP Basic Authetication for incomming request. Since They (External system) are not supprting OAUth authetication.