http headers

3,474 views
Skip to first unread message

bad...@gmail.com

unread,
Mar 29, 2014, 10:24:27 AM3/29/14
to node...@googlegroups.com
Hi,

I'm trying to get data from Node-RED into Ubidots. Their API uses authentication tokens as part of the http request, i.e. via curl you'd do something like this

curl -i --header "Accept: application/json; indent=4" --header "Content-Type: application/json" --header "X-Auth-Token: feiKTtrk8oyB7eTrMYOxitZN6srlzXrs6LTNYt0SSkH6C3f1JNSS7eZJoYxF" -X POST -d '{"value":22}' http://things.ubidots.com/api/v1.6/variables/51f153f720e1e3713c0f048f/values

Is it possible to use 'the http' request node for this sort of application? I.e., how/where would I set Content-Type and X-Auth-Token?

Boris

Nicholas O'Leary

unread,
Mar 29, 2014, 11:17:40 AM3/29/14
to node...@googlegroups.com
Hi Boris,

as per the docs for the node, you can use the 'headers' property of the message to set custom header properties.

For example, in a Function node:

    msg.headers = {
        'Content-Type' : 'application/json',
        'X-Auth-Token' : 'fei......'
    }


Cheers,
Nick


--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages