I'm trying to filter contents of an album (to get photos only) coming form Google Photos API, but the docs say that:
Filters shouldn't be used in a mediaItems:search request if the albumId is set. If a filter is used when the albumId is set, an INVALID_ARGUMENT error (400) is returned.
Does this mean that I have to download all files, than filter the response my self using the MIME type? Or can it still be done directly in the request?
Thanks!
My code:
var params = JSON.parse(localStorage.getItem('oauth2-params'));
var xhr = new XMLHttpRequest();
xhr.open('POST',
'https://photoslibrary.googleapis.com/v1/mediaItems:search?' +
'access_token=' + params['access_token'] +
'&pageSize=25' +
'&albumId=' + albumId +
'&pageToken=' + this.albums[albumId].photos.nextPagination);
xhr.responseType = "json";
xhr.onreadystatechange = (e) => {
if (xhr.readyState === 4 && xhr.status === 200) {
// handling the respons...
} else if(xhr.readyState === 4) {
console.log(xhr.status, xhr.response);
}
};
xhr.send(null);