Future of Google Location History API - google-maps

Google will be retiring Latitude soon, along with Latitude's API. But they say on their blog that Location History will still be stored and users will be able to access their history on Google Maps' Location History Dashboard. Do you know if there will be any API for receiving that location history, as there was for Google Latitude?

I've discovered that I can dynamically load my location history for any date using the following url:
https://maps.google.com/locationhistory/b/0/kml?startTime=1373666400000&endTime=1373752800000
by changing timestamps in "startTime" and "endTime" parameters. Unfortunately it's in .kml and no granularity data is included. Come on, Google - Latitude has some devoted users who relay on it on daily basis, don't kill it :(

In case you want the data as JSON with accuracy and not just the locations, you can just make the same request that the website makes. Looking at the inspector shows that it makes a request to https://maps.google.com/locationhistory/b/0/apps/pvjson?t=0. You can replay the same request with cURL (or any other way to make a POST request).
curl 'https://maps.google.com/locationhistory/b/0/apps/pvjson?t=0' -H 'origin: https://maps.google.com' -H 'accept-encoding: gzip,deflate,sdch' -H 'x-manualheader: [SOME STRING]' -H 'accept-language: en-GB,en;q=0.8,en-US;q=0.6,de;q=0.4,pt;q=0.2' -H 'cookie: GDSESS=[COOKIE DATA]' -H 'x-client-data: [ANOTHER STRING]' -H 'user-agent: [UA STRING]' -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' -H 'accept: */*' -H 'cache-control: max-age=0' -H 'referer: https://maps.google.com/locationhistory/b/0' -H 'dnt: 1' --data '[null,[BEGIN],[END],true]' --compressed
I left out my private cookie data and some details (in [..]) but you can google chrome ask to generate this for you in the developer console (right click on request -> copy as cURL). Just adapt the begin adn end times and download your location history as JSON. However, you need to download ranges of a couple of days and not everything at once. I'll leave this as an exercise for the reader.

I too am searching for an alternative solution to get my location back from Google.
Here are some facts:
Latitude will be replaced with location sharing on Google+
Android devices will continue to report location data to Google
Latitude will be removed (API, friends, website ...)
If devices will still be sending location data, Google should give us an API to fetch that data.
I've been looking into it and my location is shown on my G+ profile, but no info about granularity or timestamp.
It just says "Current location: [geocoded city]".
Reverse geocoding that address isn't very accurate. If I click on the address, Google Maps is opened in a new tab with coordinates, which seem to be pretty accurate.
So, if my location is on G+, I should be able to get it via the G+ API, right?
Well..
The only thing I've been able to find was this:
https://developers.google.com/+/api/latest/people
"currentLocation": string,
As you can see, the location data is returned as a string. I haven't tried it yet, but I would bet money that it would return the same as on my profile, just the name of the city, but not more accurate than that.
Right now it sucks. I want to get my location info, if the device is already sending it.
Installing a 3rd party app on my phone to feed my location on another service is redundant. And let's not forget about the additional battery drain and mobile data usage.
The logical step would be to put all of the latitude functionality to Google+.
We'll see, I doubt it.
Right now it just seems that they will be feeding on our privacy without us having any control or insight into it. :(

You can also download the data from Google Takeout. I know that this isn't an API, per se, but even a manual import is probably better than nothing.
https://google.com/takeout/

Related

Google Drive API - Searching for files within folders

This question is not how about to search within folders, but why I'm not getting the correct results.
This is how I'm formatting my search request which is basically a search for "mount" inside two folders.
GET: https://www.googleapis.com/drive/v3/files?q=fullText contains 'mount' AND ('{folder_id}' in parents OR '{folder_id}' in parents)
Headers:
Authorization: Bearer {access_token}
Which gets me this response:
{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": []
}
When I make the request with code, I don't get any results nor when I use an API client to manually send the request. But, whenever I use the "Try it now" in the Google Drive files list API I do get results... which is perplexing to me since I'm using the exact same query there (copy/pasting). Can anyone see what I'm doing wrong?
I'm using these permissions
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.appdata
Things I've tried:
Encoded the full query, with and without encoding the single quotation marks.
Copying the full encoded query from the "Try it now" tool.
Reduced the number of folders to search through down to one (it works in this case, anything more than one results zero results).
Changed the position of the search and the folder query.
Lowercased "AND" and "OR" inside the query.
In order to correctly understand your situation, I asked the following 4 questions.
The account of {access_token} of Authorization: Bearer {access_token} is the same as the account you tested But, whenever I use the "Try it now" in the Google Drive files list API I do get results?
When you tested "Try it now", you used other parameters except for q?
As a test case, when you use only the scope of https://www.googleapis.com/auth/drive and retrieve the access token again and test your request, what result will you obtain?
When you test the following curl command by replacing ### with your access token and placing folderId1 and folderId2 with your folder IDs, what result will you obtain?
curl -H "Authorization: Bearer ###" "https://www.googleapis.com/drive/v3/files?q=fullText%20contains%20%27mount%27%20AND%20(%27folderId1%27%20in%20parents%20OR%20%27folderId2%27%20in%20parents)"
As the result, from the section 1, it was found as follows.
I went through your questions again very carefully and I realized that I'm using a Google Service Account and not the main account. So, technically, it was not the same account even though the Google Service Account had access to some folders of the main account, but not all of folders.

Consumer API - Cards

I have completed the Build Your First Plugin tutorial and that’s all working fine. I have retrieved my account using the Consumer API with the Node.js Express app and from the command line with curl.
The Accounts API seems rather straightforward. Now I’m trying to determine how I go about retrieving the debit cards associated with my account?
I’m looking at the OpenAPI / Swagger stuff, but I’m not sure how to get Cards API to work exactly.
Accounts - From the Accounts API doc, I copied this userId, 01234567-abcd-4321-fedc-9876543210fa, to use in the Cards API.
Cards
The Cards API is used to perform actions related to credit/debit
cards.
As you can see in this screenshot, I pasted the userId that I copied from the Accounts API doc.
Cards API screenshot - The response was a 401:
“Failed to determine Banno auth type”
I suspect this has something to do with selecting the proper OpenID scopes?
I clicked the lock icon next to the Basic Cards API Get button. I selected the two OpenID scopes that it showed as being required?
CardControls-ReadOnly
CardControls-ReadWrite
When I click the Authorize button it redirects to the digital.garden-fi.com site, but I don’t recall seeing a user name and password that I can use to test.
I obviously didn’t want to put my personal information into this site just to create an account to test with.
Garden test site
There are a few different things to unpack in your question, so I'll do my best to separate things out.
1) To use the Consumer API's Cards endpoints, you'll definitely need to use the correct OAuth scopes when beginning the authentication flow.
For example, for the GET ​/users​/{userId}​/cards endpoint, you'll need to use either the https://api.banno.com/consumer/auth/cardcontrols.readonly or https://api.banno.com/consumer/auth/cardcontrols.readwrite scope. You only need one of them, not both.
This is what you would need to use as a curl command in the Terminal, for example:
curl -X 'GET' \
'https://[CONSUMER_API_ENVIRONMENT]/a/consumer/api/v0/users/{userId}/cards' \
-H 'accept: application/json' \
-H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]'
...where:
CONSUMER_API_ENVIRONMENT is specific to your financial institution and matches with Banno Online for your institution
userId is the ID for the User.
YOUR_ACCESS_TOKEN is your Access Token from the authentication flow (in JWT format)
Notably, you will need to user the userId for your user. Your question mentioned using 01234567-abcd-4321-fedc-9876543210fa, but from what I see that's not the ID of an actual user but is instead an example of how such an ID would be formatted. Apologies for the confusion.
2) The 'Interactive' API Reference
The 'interactive' API Reference that you're using is meant to be used with a demo financial institution that we have named Garden (https://www.garden-fi.com).
From what I can tell in your description, it sounds like you don't have a user nor API credentials for the Garden demo institution. Which is okay, because it's actually preferable for you to use a user and API credentials within your own financial institution.
Based on the fact that you've already gone through the Build Your First Plugin quickstart, it sounds like you've already got your own user and API credentials set up in your financial institution's Banno environment (which is actually ideal for what you're trying to do).
Again, apologies for the confusion.

Vimeo API - How to get "time available" field

I need to programmatically get the time when my live video is scheduled. But calling
GET https://api.vimeo.com/videos/46055xxxx -u <my_token>
doesn't return the field, there are several other values as created_time, modified_time, release_time but not the one I need.
Does anybody know if is it possible to get it via api?
I don't think -u is the right curl option to use for authentication with the Vimeo API, use -H instead:
https://curl.haxx.se/docs/manpage.html#-H
https://developer.vimeo.com/api/authentication#presenting-the-access-token
Second, the Live API is only available to Enterprise users, so depending on your account level you might not be able to get that scheduled event metadata anyway. You can try making a request to get the live event endpoint:
https://developer.vimeo.com/api/reference/live
https://vimeo.zendesk.com/hc/en-us/articles/360042881411-Live-API-access

Box API get shared file results in 404

Already looked at How to use box-api to get the Shared item? and Box Developers documentation https://developers.box.com/docs/#shared-items. I have tried doing a request to https://api.box.com/2.0/shared_items in .NET code, in Firefox Poster and using curl. They all resulted in 404. I have verified that my file's shared link is open to anyone with a link. Here's my curl code (sanitized):
curl https://api.box.com/2.0/shared_items -H "Authorization: Bo
xAuth api_key=xxxxxxxxxxxxxxxxxxxxx" -H "BoxApi: shared_link=https://
app.box.com/s/yyyyyyyyyyyyyyyyyyyyyyyyyyyy"
{"type":"error","status":404,"code":"not_found","help_url":"http:\/\/developers.
box.com\/docs\/#errors","message":"Not Found","request_id":"196207167555469c3017
14b"}
What might be the problem? I tried a wrong api_key and got back 401 so I know the whole setup is correct.
Your API key shouldn't be included anywhere in the request. I believe that form of authorization was used in the old v1 API and is now deprecated. There's a cURL example in the docs you linked to that shows what your authorization header should look like:
curl https://api.box.com/2.0/shared_items
-H "Authorization: Bearer ACCESS_CODE"
-H "BoxApi: shared_link=SHARED_LINK"
For more info on how to obtain the access token that goes into the authorization header, take a look at the OAuth tutorial.
The reason why authentication is required is because the API will return info about the item within the context of the caller's permissions. For example, if the creator of the shared link makes the API call, then private information (such as the item's full path within their account) will be returned. If another user makes the call, then that private information will be omitted.
That being said, you're still able to anonymously download an open shared link by navigating to it directly. You only need to use the API if you want more information about the item that the link points to.

Google Drive API downloadUrl does not work

I have some audio recordings on Google Drive
the files are "viewable by anyone with the link"
I have created a podcast feed that links to these files
In order for a podcast client to download the files, it needs a direct download link. The Google Drive API returns two fields in a file's metadata that can play this role:
webContentLink is intended to be used in a browser. It allows my podcast client to download files less than 25MB; unfortunately, over this amount Google requires user confirmation since the file is not virus-scanned. This user-confirmation step prevents my podcast clients from downloading the file if it is over 25MB.
downloadUrl is what you're supposed to use, but I cannot get it to work at all. If I copy-paste a downloadUrl directly into my browser's address bar, I get nothing. Similarly my podcast client can't download anything with a downloadUrl.
This issue seems unresolved and suggests this is still broken, but I have a few questions:
should I need to submit an API key with the downloadUrl request? No key is needed for webContentLink.
is there a workaround for this issue?
When requesting the file with the downloadUrl you must specify the following authorization in your request header:
"Authorization: Bearer $token"
Where $token is the access_token returned by gapi for the user like this:
gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token;
So if you were using curl the request would be something like this:
curl -o download -H "Authorization: Bearer $token" $downloadUrl