HTTP Client
Intro
The HTTP node allows you to send http
requests to any 3rd-party service or API you want.
How this node works
this node will simply send an http
request to the desired url and it will save the response so it can be accessible from any other node using the following syntax: koxy.res.{NODE_NAME}
.
How to use this node response
You can use the node response from any other node using the koxy.res.{NODE_NAME}
as described above, and if the response is a JSON object you can get the nested values like this (example): koxy.res.{githubsearch.items.0.login}
(this will be the value of the first item's login in the items list).
Node properties
name: node names should be unique and can't be changed.
Host url: the url you want to send the request to.
Request method: the method of the request you want to send. can be one of these values:
GET
POST
PUT
PATCH
DELETE
Headers: set your request headers. you can simply add headers by entring the header's key and value and click on Add headers.
Parameters: set your request parameters using this syntax:
q=multineon&page=2
.Body: set the request body in any format you want. remember that the request body can't be used with
GET
requests and will throw an error.Next: the trigger that the node should call after sending the request. click on the
next input
to get a list of available triggers.
Valid body
We left this for you because of the fact that you might use any Content-type
in your headers, so you should set your body based on what your Content-type
header is.
For example if you want to send your body's data and your Content-type
is application/json
you would do it like this:
'{"data": "this is data to be sent"}'
but if you want to send a request using the x-www-form-urlencoded
Content-type
your body value should be something like this:
data=this is data&data2=this is data2
Example
Please note that we are not an affliate with Github and this is just an example of how you would use the HTTP Client node.
in this example we will send a GET
request to https://api.github.com/search/users and search for github
itself :)
So first you need to give your node a name, in this example We will name it github1
.
We will set the Host url to https://api.github.com/search/users
and the request method as GET
because We are sending a GET
request.
Now let's set our headers:
We will add one header like this:
Header's key:
Content-Type
.Header's value:
application/json
.
It's time to set our parameters (Remember we can't set a body because We are sending a GET
request):
We will set our parameters as
q=github
.We will leave the request body empty.
And We will set the next trigger
to be stop so we can see what we've done so far and test if our flow is working.
Dynamic variables support
You can use Dynamic variables in the following properties:
host url.
headers.
parameters.
body.