天道酬勤,学无止境

google-photos-api

Uploading photo to Google Photos API not returning upload token

I'm using the 2018 version of the Google Photos API to upload images and media as documented here: "Uploading Bytes" When I upload a new image or video I never get an upload token in the body of the response. It's always an empty body, which according to the above link means that the bytes have already been uploaded (but this is a new upload). Here's an example request/response: request: POST https://photoslibrary.googleapis.com/v1/uploads request headers: authorization: Bearer abcd1234 X-Goog-Upload-Protocol: raw X-Goog-Upload-File-Name: 20140317T082917_001.jpg content-type: application/octet

2021-06-15 03:18:06    分类:问答    java   http   google-photos   google-photos-api

Integrate Google Photos Library API in android application

I want to integrate google photos api in android,I have done google sign in process but I am not able to get access token because i was getting error in FixedCredentialsProvider.create method while passing parameter. PhotosLibrarySettings settings = PhotosLibrarySettings.newBuilder() .setCredentialsProvider( FixedCredentialsProvider.create(/ Add credentials here. /)) .build(); try (PhotosLibraryClient photosLibraryClient = PhotosLibraryClient.initialize(settings)) { // Create a new Album with at title Album createdAlbum = photosLibraryClient.createAlbum("My Album"); // Get some properties from

2021-06-12 14:31:51    分类:问答    java   android   rx-java   google-photos-api

Google Photos API, pageSize Parameter not returning expected results

Using the Google Photos API Explorer I am trying to limit the number of albums returned using the albums.list method. If I set pageSize = 10, the api explorer returns 5 albums, if I set it to 3 in returns 1 album. Any suggestions as to why I am not seeing the same number of albums in the response as is set via the pageSize parameter? Thanks

2021-06-09 17:53:56    分类:问答    google-apis-explorer   google-photos-api

Location Data Google Photos API

When I query a photo in Google photos via the API, it doesn't return any location data that is associated with the image. I can see the location on the map when I view the information about the image in Google Photos, however the API doesn't give me these coordinates. [mediaMetadata] => Google_Service_PhotosLibrary_MediaMetadata Object ( [creationTime] => 2018-07-13T13:20:38Z [height] => 4032 [photoType:protected] => Google_Service_PhotosLibrary_Photo [photoDataType:protected] => [videoType:protected] => Google_Service_PhotosLibrary_Video [videoDataType:protected] => [width] => 3024 [internal

2021-06-01 11:32:07    分类:问答    google-api   google-photos   google-photos-api

Access Google Photo API with Python using google-api-python-client

According to Google API Client Libraries page it is possible to access the Google Photos API using the python client library, but after installing it using pip install -t lib/ google-api-python-client I don't see anything related to Photos API. How can I use the Google built client library instead of manually calling the REST APIs?

2021-05-18 01:41:17    分类:问答    python   google-app-engine   google-photos-api

How to use Google Photos API Method: mediaItems.search in Google apps script for a spreadsheet

I really tried to figure this out on my own... I am trying to load photo metadata from google photos into a sheet using the Google Photos API and google apps script. I was able to make some progress after a lot of help on a previous question Is it possible to load google photos metadata into google sheets? I now have two functions. function photoAPI_ListPhotos() - Uses Method: mediaItems.list and gives me all my photos that are not archived function photoAPI_ListAlbums() - Uses Method: albums.list and gives me all my albums What I want to do is retrieve all photos from a specific album. Method

2021-05-08 18:02:28    分类:问答    google-apps-script   google-sheets   google-apis-explorer   google-photos-api

Google Apps Scripts: import (upload) media from Google Drive to Google Photos?

I see that we can import (upload) media (photos, videos,...) from Google Drive to Google Photos. My goal is: do this task with code. I have successfully got a list of photos from Google Drive, and I store their IDs in an Array. I have this code: var arrId = [ //Some image id... ]; var length = arrId.length; var driveApplication = DriveApp; for(var i=0;i<length;++i) { var file = driveApplication.getFileById(arrId[i]); //Now I got the file, how can I programmatically import this file to Google Photos } I have searched the docs of Google Script, but I couldn't find any API of Google Photos

2021-05-06 20:45:06    分类:问答    google-apps-script   google-drive-api   google-photos   google-photos-api

Can upload photo when using the Google Photos API

I am trying to upload a photo (jpg image) using the new Google Photos API. I am able to get an uploadToken but when I try to create the media item I get the following error: { "newMediaItemResults": [ { "uploadToken": "CAIS+QIAkor2Yr4JcvYMMx..... ", "status": { "code": 3, "message": "NOT_IMAGE: There was an error while trying to create this media item." } } ] } Here is a snippet of my code: import sys import json import requests pic = 'image.jpg' fname = 'read_write_token_creds.json' with open(fname) as f: data = json.load(f) tok = data['access_token'] # Step 1 get an upload token URL = 'https

2021-04-27 07:23:54    分类:问答    python   google-photos-api