Unable to get accurate results from Browserlocation API with curl - google-maps

I'm trying to get the current location of my computer from Google's BrowserLocation API.
How to create a script to query Google Browserlocation: This thread helped me construct the script, but one problem remains: the accuracy is way off when using curl from the command line: "accuracy" : 11178. Bafflingly, if I copy-paste the same address in my browser, the returned JSON is perfectly fine with an accuracy of "accuracy" : 52.
What could the crucial difference be, and how do I modify the curl script to work like my browsers do? There is JSON, CURL and Google's geolocation this previous thread with what appears to be a similar issue, but the solution posted does not help me.
I have Wireshark, and a capture of the two methods of accessing the API. I am currently trying to figure out how to retrieve the relevant packets for inspection. If anyone can help me with this intermediate step, that would be most welcome.

Well I got it to work. The issue was that I didn't URL escape the names of the access points. Look here for how to do this with Perl.

Related

get all channel info with youtube api and curl

Hey guys i was perusing the youtube api documents and saw this json snippet right here: https://developers.google.com/youtube/v3/docs/channels#resource-representation
I saw this and would like to grab all this info from the specified youtube channel in my curl code. So far all i wrote was this:
curl "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=[CHANNEL NAME]&key=[API KEY]"
but that only gives back a small part of that json, i think its the "statistics" part.
If yall can help that would be so kind, thanks.
To get the other info attached to a given channel, do mention the set of properties you're interested in via the part parameter, as specified by the reference doc.
Update:
To get all the info available, the URL to be passed to curl would be:
https://www.googleapis.com/youtube/v3/channels?part=brandingSettings,contentDetails,contentOwnerDetails,id,localizations,snippet,statistics,status,topicDetails&id=[CHANNEL NAME]&key=[API KEY]
Note that the part parameter does not contain auditDetails since that requires additional permissions.

Incomplete Json - Behance API

I'm working with the Behance API to build a plugin. I got the API key and built the URL to get my project list data in JSON format.
The weird thing is that, the JSON is not complete at all, there are many project missing, 14 missing to be specific.
Does someone have any idea?
Thanks in advance.
Found the solution here: https://help.behance.net/hc/en-us/community/posts/202357274-Number-of-Behance-API-request-results-limited-to-25-
It seems that by default the number of items is limited to 25. To get more you need to paginate adding a query get after the URL.
ex: http://www.behance.net/v2/users/gokhanaltinigne/projects?api_key=##&per_page=25&page=2

Signature not valid

So I am using Amazons Product Advertising API and getting SignatureDoesNotMatchThe everywhere I turn.
The problem is not with my code because I have started using this scratchpad < http://associates-amazon.s3.amazonaws.com/scratchpad/index.html >
What gives? I have created a credential in AWS like all others - what else do I need to do or why is this just failing?
The full error is as follows:
<?xml version="1.0"?>
<ItemLookupErrorResponse xmlns="http://ecs.amazonaws.com/doc/2011-08-01/"><Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message>
</Error>
<RequestId>a89715b8-8e81-4d33-ad94-b85c92fb0631</RequestId></ItemLookupErrorResponse>
I found signing requests to be painful. I finally got it to work by reading the documentation carefully and using the Signed Requests Helper tool.
The documentation
https://docs.aws.amazon.com/AWSECommerceService/latest/DG/prod-adv-api-dg.pdf
outlines the steps starting on page 55. My problem was getting the url encoding right. Also, as vinayr mentioned, the parameters do have to be in a specific order (byte order, I think).
HOWEVER, the available library makes everything waaaaay easier. I've been using it for weeks now. It converts the XLM responses into an object that holds all the data and is easy to use.
I recently answered the question here:
https://stackoverflow.com/a/33617604/5543992

HTTP request error from running Postman Collection tests with Newman?

I've been using the new commandline for Postman, Newman, and have been attempting to run Collection tests that work fine when I pass them through the packaged app Jetpacks add-on, but do not run properly in the commandline. Although the json Collection file that I am passing does contain the proper header declarations, I don't have any other clues at this point, so I suspect that this may be an HTTP header issue. But I am not sure exactly what is wrong, as I am rather new to using Postman.
The tests that I'm trying to run are on some calls to an ASP.Net web API, very simple server response-checking one-line javascript tests like the ones in this tutorial.
A sample line that I enter into the console:
$ newman -c collectionfile.json -e environmentfile.json -n 5
achieves such a result:
RequestError: [token] terminated. Error: undefined
Any suggestions/help would be appreciated.
I ran into this problem as well and spent quite a few hours trying to figure it out. Eventually I realized that an address such as "www.google.com" will work in the chrome plugin UI, but not in Newman. For it to work in Newman, the address must be "https://www.google.com". Also, make sure that you have your data file (if you are using variables like {{url}}) set up correctly. You can use "-d dataFile.json" to define a data file. More information on that here.

jsFiddle how to get json?

Hy,
I'm working on a jsFiddle with a openlayers example in it.
http://dev.openlayers.org/releases/OpenLayers-2.11/examples/snapping.html
At the moment it's not working because it's not getting a response for the http request to get data. How do I fix that?
The jsFiddle is here: http://jsfiddle.net/TcuxA/6/
Go to the line "// create three vector layers" in the script.
There are 3 requests for data. If you type the URLs in your browser you get the JSON, but my firebug gives 3 errors when I run the jsFiddle.
I tried fixing with jsFiddle echo ( http://doc.jsfiddle.net/use/echo.html ), but that didn't work. I don't know how to change the script to load the data otherwise.
Why can't I get the json by these URLs? What are good sollutions?
What you are experiencing is an exception being thrown by the XMLHttpRequest object, because you are using AJAX to call elements from different domain. This is better said, for example, in here:
"The XMLHttpRequest object is prevented from calling web services from outside its own domain. This is sensible given that if you called a script in one place and it, in turn, called a script on another server, it could leave an application open to all sorts of malicious scripts, hacks and exploits."
So the easiest way to do is to code it locally and call a local copy of the files (poly.json, line.json and point.json) that would reside on your local server. For testing if all displays on a map you could hard-code the files into your code. I am not sure how it could be achieved otherwise.
A good solution can be this : using github responses . You can store your example in github, along with the predefined XHR requests responses.