Skip to main content

Authentication

We need to send a request to the Authentication endpoint to get the token.

⚠️ You can find the needed blocks from the "transformer" in the FME tools.

To make an HTTP request:

  • Select a Creator block (There is no need to change anything in its settings).
  • Select an HTTPCaller and connect the Creator output arrow to the HTTPCaller input.

  • Set the Content Type to JSON(application/json). ⚠️ Since we know that the response would be a JSON document.
  • Click on the down arrow next to the Upload Data input, and then from the dropdown menu, choose Open Text Editor.

  • Put the following object:
  {
"username":"INTEGRATION_USERNAME",
"password": "INTEGRATION_PASSWORD",
"client_secret": "INTEGRATION_SECRET",
"client_id": "integration",
"grant_type": "password",
"scope": "integration"
}
  • Set Save Response Body To Attribute

After the setup of the HTTPCaller, we have to save the token and the response message. To extract these JSON properties from the JSON document we got, we need to select a JSONExtractor block and connect the output of the HTTPCaller to the input of the JSONExtractor.

JSONExtractor Settings:

  • Set the Input Source to JSON Document.
  • Click on the down arrow icon next to the Input Source. From the dropdown menu, choose Attribute Value and then select _response_body which is actually the response body of the HTTPCaller saved in _response_body attribute.
  • Now, we have to extract the JSON properties we want to save in the attributes.
  • In the Target Attribute column, kwrite the token and its corresponding JSON Query value which is json[“access_token”].
  • click on Ok!

⚠️ We are saving the token to use in further requests.

⚠️ We are saving the responseCode to check whether we had any error or not.