Is it possible to list object in Google Cloud Storage using the meta? - google-cloud-storage

I am reading this article https://cloud.google.com/storage/docs/json_api/v1/objects/list, and I didn't find it.
I have a bucket with thousands of objects (files). I want to list only object that have specific metadata.
Do you know how to achieve that?

There's no API support for server-side filter of listing results by metadata values. You would need to list all the objects and then filter at the client side. Another option, if it's possible to rename your objects, would be to construct your object names such that the metadata values on which you want to filter are built into the beginning of the object names. You could then use a prefix filter on the listing request.

Related

Fetch object list from GCS bucket in descending order of createTime

I'm using following rest API to fetch object list from bucket hosted at google cloud storage.
GET /storage/v1/b/<bucket>/o
The objects in response are ordered by time in ascending order. Since I have too many objects in the bucket I don't want to fetch them all. Instead I want to fetch objects in descending order and with a limit on the number of items.
This is not currently possible with the API. You'll have to list all objects.
Alternatively, you could consider using Cloud Pub/Sub Notifications which lets you get a feed of newly created objects, if that fits your use case.

How to get a list of collection names from workfront api

I'm trying to access the collections on an object from Workfront via: /attask/api/v4.0/approval/search?fields=approverStatuses:*
My question is, how do I get a list of the collection names on that object if for example, the object has multiple collections, such as the object approval. Is there a way to use REST to get that list? This is a conflict since the collection name is not the same as the object name, example:
Object Name: approverStatus
Collection Name (under approval): approverStatuses
Thanks,
I was able to figure this one out myself. The correct REST request is the following:
/attask/api/v4.0/approval/metadata?fields=collectioins
You have to access the top level object of approverStatus and it'll return a list of all the collections it has (this includes approverStatuses).

Feed JSON to Nominatim with import.io

Greetings fellow SO users,
I am extracting data with import.io from a site which contains city names. What I want to accomplish is to get the coordinates to each city from Nominatim and finally create/get a JSON response which contains the city name and the corresponding coordinates for each.
So I basically need to use the result from one API as the input for another (Nominatim).
Or in other words: feed a JSON list of city names to OSM's Nominatim and get back the coordinates to each city.
I wonder if this is even possible or what other options I have. Finally this would be used with leaflet to put some markers at a map.
There are tutorials for Nominatim, how to query etc. but only one query at a time. Is it even possible to query a whole list of places?
What you want to achieve in here is what we call Chained APIs. So you will need two APIs, where the input of the second one is the output of the first one.
In this case you will need some custom processing between the two APIs. From the first API you are getting the city name and from here you need to generate a list of URLs in the format http://nominatim.openstreetmap.org/search?q=CITY&format=xml one per each CITY.
After that you can use the Bulk Extract feature in import.io and pass the whole list of URLs to be queried against the API.

AWS iOS SDK Get bucket metadata

I see that there is an S3GetObjectMetaDataRequest, but is there some way to get the meta data of all objects in the bucket? I've checked S3ObjectSummary and it doesn't have any meta data.
To get information about objects in a bucket through the API you will have to iterate through a list of enumerated objects, i.e. you have to get a list of the objects and then individually make calls for each object you want information on, i.e. there's no way to say something like "gimme an array with metadata for all objects". I learned this after hours of working with S3 object versioning.

Multiple tags / folders in Google Reader

I want to be able to grab data from multiple tags / folders in a users Google Reader.
I know how to do one http://www.google.com/reader/atom/user/-/label/SOMELABEL but how would you do two or three or ten?
Doesn't look like you can get multiple tags/folders in one request. If it's feasible you should iterate over the different tags/folders and aggregate them in your application.
[edit]
Since it looks like you have a large list of tags/folders you need to query, an alternative is to get the full list of entries, then sort out the ones the user wants. It looks like each entry has a category element that will tell you what tag is associated with it. This might be feasible in your case.
(Source: http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI)
(Source: http://www.google.com/reader/atom/user/-/state/com.google/starred)
I think you cannot get aggregated data as you hope to be able to. If you think about it, even Google lets you browse folders or tags one at a time, and do not aggregate a sub-set of them.
You can choose to have a list of all the items (for each one of their available statuses) or a list of a particular tag/folder.
You could do it in 2 requests. First you need to perform a GET request to http://www.google.com/reader/stream/items/ids. It supports several parameters like
s (required parameter; stream id to fetch; may be defined more than one time),
n (required; number of items to fetch)
r for ranking (optional)
and others (see more under /ids section)
And then you should perform a POST request (this is because there could be a lot of ids, and therefore the request could be cut off) to http://www.google.com/reader/api/0/stream/items/contents. The required parameter is i which holds the feed item identifier (could be defined more than once).
This should return data from several feeds (as returned for me).