HTTP requests are made up of four parts. Take this example client request to a FHIR API:
1) Method - the action to be performed on a resource
The method indicates the action to be performed on a resource within the API.
With Iguana’s net.http.* library, you can invoke different HTTP methods:
net.http.get{} - query or retrieve resources.
net.http.post{} - to add or create a resource.
net.http.put{} - update an existing resource.
net.http.delete{} - remove a resource.
2) Endpoint - the URL where the resource is found
The URL defines where the client can access the desired resources - for example the Patient resource.
url='http://hapi.fhir.org/baseR4/Patient'
Query String:
For GET requests, the URL may also contain any necessary query parameters like the id of the patient you are searching for.
When using net.http.get{}, the parameters argument takes in a table of key-value pairs and automatically formats the query string. The url can also be hardcoded to handle query parameters if desired.
The ? indicates the end of the url and beginning of the parameters. Key-value pairs are separated by &.
Authentication information like credentials, cookies, or an access token
MIME types
Entity tags (ETAGS)
4) Body - the payload of the request, containing the content to be sent
Some requests require a body where we add the resource content or additional information to be sent to the server. The HTTP formats will typically be specified by the API you’re working with and often requires the appropriate Content-Typeheader. Common formats include: