HTTP Requests
Basic explanation of HTTP Requests in the tekos flow.
Last updated
Basic explanation of HTTP Requests in the tekos flow.
Last updated
Now days all apps use the HTTP Requests and we either, our whole ecosystem is based on the requests.
In this tutorial we are going to showcase some example usage of the requests in the flow.
The Tekos Flow comes with three basic HTTP nodes which are:
HTTP Request - Sends HTTP requests and returns the response.
HTTP In - Creates an HTTP end-point for creating web services.
HTTP Response - Sends responses back to requests received from an HTTP Input node
It is possible to even create web pages using the tekos flow.
Remember to check the HELP tab of the HTTP nodes in the flow editor.
Method | Description |
GET | The |
HEAD | The |
POST | The |
PUT | The |
DELETE | The |
CONNECT | The |
OPTIONS | The |
TRACE | The |
PATCH | The |
Both of those nodes are often necessary to properly configure an endpoint
Let's create an POST endpoint in my flow to adres /tekos/documentation that just responses with payload "It's working!" and code 200 - OK.
Check the full list of available response codes https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
Above endpoint will be available under my flow instance adres "https://instance-name.tekos.co/tekos/documentation"
This node allows you to do a HTTP Request to any service endpoint. We can use our previously created one using the HTTP In & HTTP Response, but let's use function node instead of change, and in this function we will enter simple command to iterate the number stored in the payload.
While we have our endpoint prepared let's create an flow with POST Request
As you can see we have an inject node to manually trigger the request, an function node, http request and a debug node, don't mind the change node it is just to hide my instance name.
We have also set the msg.payload value to 10, while our endpoint have a function to iterate the msg.payload so the response from this endpoint should be 11. Let's take a look
Of course this is just a basic example of how to create endpoint and send an http request to it.