CONFIGURING AN API REQUEST

IoT server provides built-in nodes for making HTTP requests. These nodes are categorized as "http request" and "http response" nodes in the IoT server palette. The "http request" node allows you to send HTTP requests to external APIs or web services, while the "http response" node allows you to handle the responses received from those requests.

You can either download the yaml file from braincube.io and open using a service such as postman or use the API in Data Flows Manager as outlined below.

Configure msg in a function node preceding the http request node
http_request_node

How to configure msg:

Contains three msg objects

  1. URL
  • The url of the api to request
    These can be found in the braincube.io documentation
    1. Method
  • POST
    Creates data at an endpoint
  • GET
    Gets data from an endpoint
  • DELETE
    Removes data
  • PUT
    Updates data at a given endpoint
  • PATCH
  1. Headers
    Headers generally have 2 objects inside.
    The first two, ‘accept’: ‘application/json’ & ‘content-type’: ‘application/json’ should almost never change.

Configuration with API key:

msg = {
'url': https://api.mybraincube.com/braincube/{yourBraincube}/
'method': 'GET',
'headers': {
'accept': 'application/json',
'content-type': 'application/json',
'x-api-key': ""
}
}

Configuration with IPLSSO Token:

msg = {
'url': https://api.mybraincube.com/braincube/{yourBraincube}/
'method': 'GET',
'headers': {
'accept': 'application/json',
'content-type': 'application/json',
},
'cookies': {'IPLSSOTOKEN': 'tokenValue'}
}

Was this article helpful?

Powered by Zendesk