title: Convert REST curl command to Apex Request
body: <p>I have a curl example of a REST API call as follows </p>
  
  <pre><code>curl https://api.endpoint.com/api_action.json \
  -u key:secret \
  -d 'message=Hello World' \
  -d id=12345
  </code></pre>
  
  <p>Now I'm trying to replicate this using the Apex HttpRequest class but I'm unsure as to how I should be passing the options into the call. </p>
  
  <p>What I have so far is as follows</p>
  
  <pre><code>HttpRequest req = new HttpRequest();
  req.setEndpoint(https://api.endpoint.com/api_action.json);
  req.setMethod('POST');
  // what goes in these
  req.setHeader(stuff);
  req.setBody(stuff);
  
  Http http = new Http();
  HttpResponse res = http.send(req);
  </code></pre>