HTTP Get
Hello guys,
I am still new with nodebox, i just didnt know how to get the string or value from the http get node. ive tried lookup node but cant. Can anyone tell me how? Big Thanks!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Muhammad Syahma... on 14 Apr, 2013 10:31 AM
Nvm guys, done. :)
Btw, i made a simple map of Malaysia, and by using Google Maps API, i can map it to my custom map. :)
Support Staff 2 Posted by Frederik De Ble... on 16 Apr, 2013 02:43 PM
The procedure with the lookup node is correct. In short:
1. Create a HTTP Get node.
2. Connect the output to a lookup node.
3. Set the "key" parameter of the lookup node to "text".
Important: network support is experimental and the API can change. The "text" field will be renamed "body" in future versions of NodeBox.
Kind regards,
F
3 Posted by sjeon01 on 24 Apr, 2013 05:04 AM
Hello, I am really curious how you got the API data from google map and create your own. It seems like connecting the lookup node to the http-get node is not enough to generate any workable data. Thanks.
4 Posted by Muhammad Syahma... on 24 Apr, 2013 07:42 AM
Hello sjeon01, well i used this API, https://developers.google.com/maps/documentation/geocoding/
for an example, i put this "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphi...; at the HTTP get, and it will output a JSON format,
you must call the "text" from the HTTP Get first using lookup, then by using JSON Query, use this, "$results"
then u will get all the data, u can filter it down, by using lookup, and more json query.
so, that is how i acquire the longitude and latitude for a location.
then i load a malaysia custom map using svg, and make my own grid, create some range from the min and max coordinates of malaysia map in google map, and so i resize it to fit the range.
Support Staff 5 Posted by Frederik De Ble... on 24 Apr, 2013 08:37 AM
In fact, the JSON Query node is smart enough to get data immediately from the HTTP Get node, so the lookup node is optional.
Frederik De Bleser closed this discussion on 24 Apr, 2013 08:42 AM.
Muhammad Syahman re-opened this discussion on 24 Apr, 2013 08:55 AM
6 Posted by Muhammad Syahma... on 24 Apr, 2013 08:55 AM
yes indeed, but can u like give the json query documentation? cause somehow
i dont really get it to get data i need.
Support Staff 7 Posted by Frederik De Ble... on 24 Apr, 2013 09:13 AM
The "query JSON" node uses JSONPath, which is a way to dig into JSON using a path expression. Documentation on the standard is here:
http://goessner.net/articles/JsonPath/
Specifically for your use case about geocoding:
$
.$.results
$.results[0]
$.results[0].geometry.location
At this point, Query JSON gives me a table containing "lat" and "lng" columns. Here, you can use two lookup nodes to extract "lng" (the X coordinate) "lat" (the Y coordinate). Note that latitude needs to be flipped (negated) to map to the Y coordinate.
I've included an example that demonstrates geocoding.
Kind regards,
Frederik
Frederik De Bleser closed this discussion on 24 Apr, 2013 09:13 AM.
Muhammad Syahman re-opened this discussion on 24 Apr, 2013 09:35 AM
8 Posted by Muhammad Syahma... on 24 Apr, 2013 09:35 AM
Thank you so much!!!!!
Help me a lot. yeah, thanks for the JSONPath and the geocoding.
Support Staff 9 Posted by Frederik De Ble... on 24 Apr, 2013 09:36 AM
You're welcome!
Frederik De Bleser closed this discussion on 24 Apr, 2013 09:36 AM.