How to extract specific elements from the Google Geocoding json response through a URL? - json

So I want to be able to run this
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&result_type=street_address
which returns a json response with many results...
Id like to be able to parse the json from the url itself...
so something like. ....
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&result_type=street_address&results[0].formatted_address
so that instead of getting a multiline response - I just get what I need in a single line such as...
277 Bedford Avenue, Brooklyn, NY 11211, USA
Sure I can write a script to do this but I wonder if specific fields of the JSON are restful.
Am i talking smack or is this possible ?
Thank You

Although RESTful web services may utilize JSON, the fields of JSON results themselves are not RESTful. Parsing values from the URL would probably require you to change how Google handles url processing on the server end. You'll have to get that information programmatically.

Related

How can I make a list of only specific items of an API JSON file?

I have a body of data in a JSON file from an API GET request, but I can't figure out how to get only the specific items I need from it.
I have Visual Studio Code installed, is there a way to do this in it?
I'm not sure if I understood the question. As I understood, you send a request to an endpoint and receive a JSON object.
You can check the documentation of the API you're using. It can have other endpoints or query parameters that return the data you're looking for. In any case, you can filter the data yourself with the help of a programming language.
If you be more specific with the language and API you're using; JSON you receive and the desired result, you can get a better response.

Is there a way to return a full formatted address using map quest api?

I'm using MapQuest's GeoCoding API for a weather app I'm creating (this is due to having many complications using google's API), and the response returns each aspect of the address as a separate value, however unlike Google's API, there does not seem to be a value that returns the full formatted address (i.e 10 Duke Street, Putney, London, SW15 6EH, United Kingdom).
Am I missing something, or do I have to recreate this manually?
Use the outformat function
Reverse Geocode
outFormat
optional, defaults to json
Specifies the format of the response. Must be one of the following, if supplied:
json
xml
csv (character delimited)
Example: XML response
outFormat=xml
If you return the data as a csv from the API it is closer to the format you require as an address.
"Country","State","County","City","PostalCode","Street","Lat","Lng","DragPoint","LinkId","Type","GeocodeQualityCode","GeocodeQuality","SideOfStreet","DisplayLat","DisplayLng"
"US","FL","Duval","Jacksonville","32225","12714 Ashley Melisse Blvd","30.333472","-81.470448","false","0","s","L1AAA","ADDRESS","R","30.333472","-81.470448"

Bing Maps Location api: Getting response as string

Hi I am using Bing location api to return the address of the user.
https://msdn.microsoft.com/en-us/library/ff701710.aspx
But the response it is returning is in JSON or XML. I want the same in string format that could later be stored in a list as plain text.
The location API returns JSON or XML as there is a lot of data in the response. It's not simply a single line of string. There are coordinates and address parts and names, multiple results. Parsing out the info you need is easy. If using .NET, use this library: https://github.com/Microsoft/BingMapsRESTToolkit

How to force Search and Promote returns JSON format instead of xml?

In our application we send requests to S&P like this:
http://SearchAndPromoteUrl/?parameter1=1&parameter2=2
My current understanding that S&P is external cloud service. sometimes we collect statistic and send to the server. Server analyzes our feed and we can get niformation from this S&P server.
1.Where can I found valid parameters after http://SearchAndPromoteUrl/?
2.Which manipulations should I execute for getting JSON instead of XML(S&P server should returns JSON Now our S&P returns xml).
This article says that it is possible
related information
http://microsite.omniture.com/t2/help/en_US/snp/8.15.0/SPguide.pdf
First I'd suggest using the updated documentation - https://marketing.adobe.com/resources/help/en_US/snp/8.16.0/c_getting_started.html
The recommended way to integrate with S&P is to use the search form they provide. This form takes care of the request and parameters for you.
UPDATE: Here are more details: https://marketing.adobe.com/resources/help/en_US/snp/t_copying_the_html_code_of_the_search_form_into_the_pages_of_your_website.html
Yes, you can use JSON instead of the standard XML response, and it's quite simple: just write your own presentation template using JSON instead of XML (see https://marketing.adobe.com/resources/help/en_US/snp/8.16.0/c_about_templates.html)
Have a nice day.

Appcelerator Requesting and using Json file

I'm learning how to use a third party API called Wunderground and I don't know how to request, receive, and use their results which is in a Json format.
If you see their website a developer can sign up for free and receives an API KEY. You can then request weather data in the following URL format.. http://api.wunderground.com/api/KEY/FEATURE/[FEATUREā€¦]/[SETTINGā€¦]/q/QUERY.FORMAT
So I have tried it in my web browser by typing some parameters and I received a very long Json file with the correct information (I checked). Problem is I don't have the slightest idea of how to create a variable which can make this request, and even if I was able to do that I don't know where should I receive the file and how to get only the results I want (in this case current weather).
You have to use Titanium.Network.HTTPClient to make request.
For code examples related to Json parsing you can use:
Appcelerator: Using JSON to Build a Twitter Client
HTTPClient()