Monitoring Flickr’s Interestingness SOAP API

The API Science platform provides capability for monitoring APIs that utilize SOAP (Simple Object Access Protocol) interfaces. The photo sharing site Flickr offers a substantive API that can be accessed using multiple protocols, including SOAP. In this article series I’ll use the Flickr API to illustrate techniques that can be applied for monitoring the status and performance of SOAP-based APIs.

Flickr invented a metric they call interestingness, which ranks posted photos based on statistics including clickthroughs, comments, favorites, tags. The Flickr API includes flickr.interestingness.getList. This API method returns a list of photos having a high interestingness rating for the most recent day or a user-specified date. Here is an example request body for calling the interestingness API:

In this example, the SOAP s:Body element includes three elements:

  • method: the designated endpoint method for this call
  • api_key: the user’s key (used for gaining access to the API) that was provided by Flickr
  • per_page: the number of images to be returned per page

Image lists are divided into pages with a user-specified number of images per page (100 results per page is the default value). Several optional request variables are available, but for this demonstration I’ll use just these three.

To create an API Science monitor for the Flickr interestingness method, we create a new monitor that points to the URL

The “Request Body” field contains the SOAP XML displayed above. Here I apply a simple Javascript validation that checks if the response content type includes the characters “soap”:

var contentType = context.response.headers['Content-Type'];

assert(contentType.indexOf("soap") >= 0,
       "not SOAP content");

The Content-Type header for a normal response from the API will be: application/soap+xml; charset=utf-8. The Javascript validation ensures that the response will be considered valid only if the Content-Type header includes “soap”; otherwise, the check fails.

A successful run of this monitor will produce a response body similar to:

Here we’re viewing the response XML in a web browser. The x:FlickrResponse element consists of:

  • photos: a heading element that identifies the results page that follows along with the number of pictures per page
  • photo id: a set of image results, identifying the photo ID, owner, secret, server, farm, title, and picture post status (public, posted by a friend, and posted by a family member)


Now we’ve created an API Science monitor that calls Flickr’s interestingness SOAP API to return three interesting photos from the most recent day. We’ve embedded a simple validation that ensures the response is in SOAP format.

In my next post, I’ll add steps that extract data from the SOAP packet response. This data could be used to create additional validation tests; or it might be used as input data for a second call to another method provided by the Flickr SOAP API.

–Kevin Farnham