I have a site now where we use cfdirectory tag to query to get the directory contents.
In the directories are images; like this
Then we use this info to display these images on the page. Anywhere from one to 10 images in each directory.
Now we are moving our images to Google Cloud and cannot use the cfdirectory the way we currently do.
Has anyone used the Google API to query/list directories on the Google cloud and pushed the results back to a cf site?
Once I can get that info from google I can figure how to output images.
The only way I can see you using CFDIRECTORY to iterate through files right now, is to have a local cache of those files that synchronizes with Google Cloud storage. Otherwise, you're going to have to bring back file identifiers and sort them some other way. There are a bunch of command-line tools that will let you connect to Google Cloud to do this, so you could conceivably use one of those.
Dave Watts, Eidolon LLC
I haven't worked with images the way you're trying to. But I can share with you my experience with APIs in general.
In ColdFusion, a collection of files is represented by a directory. On the API it is represented by a collection resource. Let's call the resource containing the images ImageCollection.
Your starting point is then a GET request to the URI of ImageCollection. This is the equivalent of a list-action on cfdirectory.
The list will contain the (API resource) ID of each image file. As Dave_Watts has said, you will then have to find a way to identify which ID corresponds to which image file.
Take a file whose ID is img1234, for example. To obtain it, you have to perform a GET request to its URI http://.../ImageCollection/img1234
So in some cases I have to the Google Cloud Storage is going to return more than one result.
For these I can get the info in XML or JSON format and Ill need to extract certain fields.
Does CF work with one better than the other?
In my opinion, XML and JSON are just as good as each other in this particular situation. XML has the advantage of being more formal (using namespaces, for example) and it has a tradition in ColdFusion (including search capabilities). JSON's advantage is that it is less cumbersome to work with (being easily converted to a struct) and has a smaller memory footprint in the long run.