HTTP Get

Muhammad Syahman's Avatar

Muhammad Syahman

13 Apr, 2013 05:50 PM

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!

  1. 1 Posted by Muhammad Syahma... on 14 Apr, 2013 10:31 AM

    Muhammad Syahman's Avatar

    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. :)

  2. Support Staff 2 Posted by Frederik De Ble... on 16 Apr, 2013 02:43 PM

    Frederik De Bleser's Avatar

    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. 3 Posted by sjeon01 on 24 Apr, 2013 05:04 AM

    sjeon01's Avatar

    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. 4 Posted by Muhammad Syahma... on 24 Apr, 2013 07:42 AM

    Muhammad Syahman's Avatar

    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.

  5. Support Staff 5 Posted by Frederik De Ble... on 24 Apr, 2013 08:37 AM

    Frederik De Bleser's Avatar

    In fact, the JSON Query node is smart enough to get data immediately from the HTTP Get node, so the lookup node is optional.

  6. Frederik De Bleser closed this discussion on 24 Apr, 2013 08:42 AM.

  7. Muhammad Syahman re-opened this discussion on 24 Apr, 2013 08:55 AM

  8. 6 Posted by Muhammad Syahma... on 24 Apr, 2013 08:55 AM

    Muhammad Syahman's Avatar

    yes indeed, but can u like give the json query documentation? cause somehow
    i dont really get it to get data i need.

  9. Support Staff 7 Posted by Frederik De Ble... on 24 Apr, 2013 09:13 AM

    Frederik De Bleser's Avatar

    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:

    1. The expression always starts with $.
    2. Then, we're interested in results, so we append that: $.results
    3. There can be multiple results but we're only interested in the first one: $.results[0]
    4. I'm interested in the latitude and longitude, located under "geometry", then "location": $.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

  10. Frederik De Bleser closed this discussion on 24 Apr, 2013 09:13 AM.

  11. Muhammad Syahman re-opened this discussion on 24 Apr, 2013 09:35 AM

  12. 8 Posted by Muhammad Syahma... on 24 Apr, 2013 09:35 AM

    Muhammad Syahman's Avatar

    Thank you so much!!!!!

    Help me a lot. yeah, thanks for the JSONPath and the geocoding.

  13. Support Staff 9 Posted by Frederik De Ble... on 24 Apr, 2013 09:36 AM

    Frederik De Bleser's Avatar

    You're welcome!

  14. Frederik De Bleser closed this discussion on 24 Apr, 2013 09:36 AM.

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

Recent Discussions

22 Feb, 2024 05:51 AM
22 Feb, 2024 01:11 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM
16 Feb, 2024 05:24 PM

 

06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM
04 Jan, 2024 11:49 PM