A good place to start would be to look at the documentation on HttpRequest.
Most everything should map fairly intuitively from cURL.
For example...
POST
, GET
, PUT
, etc... are Http methods, so use setMethod(String method)
- you'd pass
'https://thingspace.verizon.com...'
into setEndpoint(String endpoint)
- each individual header is set by using
setHeader(String key, String value)
, e.g. request.setHeader('Authorization', 'Bearer <token string here>')
- POST data is sent in the body of the request, so
setBody(String)
is what you'd use
The actual request is sent by using the send()
method of the Http
class (documentation here)
About the only other gotcha that I can think of is that you can't examine the network request (because it is sent from one of Salesforce's servers), so it's a very good idea to store the HttpResponse
result you get from Http.send(HttpRequest request)
in a separate variable, and have logic to inspect the status code via HttpResponse.getStatus()
and HttpResponse.getStatusCode()
.
If you don't check the response code/message, you won't have any way of determining if your callout worked, or what went wrong (if it didn't work).