Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
title2) Endpoint - the URL where the resource is found

The URL defines where the client can access the desired resources - for example the Patient resource.  

Code Block
url='http://hapi.fhir.org/baseR4/Patient'

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.

Code Block
https://api.example.com/resource?param1=value1&param2=value2
Expand
title3) Header - the metadata providing information about the request

The header includes metadata requirements defined by the API to provide information about the request.

Code Block
headers= {
  ['Content-Type'] = 'application/fhir+json',
  ['Authorization'] = 'Bearer '..token
}

This can contain information such as: 

  • Connection and content types 

  • Authentication information like credentials or an access token

  • MIME types

  • Entity tags (ETAGS)

Expand
title4) Body - the payload of the request, containing the content to be sent

Some requests (PUT and POST) require a body where we add the resource content or additional information to be sent to the server. This can be in a few potential formats:

JSON

Code Block
languagejson
[{
    "patientid": "33751",
    "status": "active",
    "firstname": ”Bruce",
    "lastname": ”Wayne",
	...
}]

XML

Code Block
languagexml
<patient>
  <patientid>33751</patientid>
   <status>active</status>
   <firstname>Bruce</firstname>
   <lastname>Wayne</lastname>
</patient>

Query String format

The query string can be found in the body or can be included in the URL of the request.

Code Block
patientid=33751&status=active&firstname=Bruce&lastname=Wayne

...