In our latest collection of images available via our API, we've created an archive of historical photographs and other digital material made available via the State Library of Queensland (SLQLD). The collection was generally collated from images created between 1914 and 1918 so, as you would expect, there's a large number of wartime references.
We've formatted the data as best we could (for now) and created a relational source of data that can easily be integrated into desktop and mobile applications.
The Result
The API endpoint for all requests is http://api.beliefmedia.com/australia/qld/slqld1418.json
. A number of parameters determine how information is returned.
id
itemid
is required along with your API Key. If an ID is passed via the URL, all other parameters will be ignored.type & search
browse
, search
, or tag
. If no type is defined and no id
is present in the URL (to return a single result), browse
will be used. If the type
is search
or tag
, a search
term must be provided.pg & number
pg
parameter determined the page to be returned. number
determines how many results will be shown.■ ■ ■
Our first example shows a request for a specific record. Using slqld1418.json?apikey=xxx&id=slqld1418_XoDl
returns JSON that unfolds as follows:
The description field returns an associative array since a large number of results include multiple titles and/or captions (as shown below).
Since the collection of images was mashed up from various collections, the type and quantity of data will vary. For example, the geographic data is only returned for 6,141 results, and 1,710 results don't include a description.
Browsing & Searching Results
To browse or search a result, use the following: slqld1418.json?apikey=xxx&pg=1&number=10&type={tags|browse|search}&search=soldier
. The search parameter need only be provided if searching text or tags (the unique tags of which is the imploded category/subject array).
Images
Of the 16,368 rows in the initial (dated) data, a number of image references were empty or returned 404 (not found) errors. After removing invalid rows we were left with 15,886 rows.
The entire image collection may be downloaded from our client area (2.8GB). The image path (honored in the download) is as follows: {year}/{itemid}.jpg
(1000px image) and {year}/{itemid}-t.jpg
(150px thumbnail). When a year was unable to be resolved we simply use 1234
. The images hosted by the SLQLD are 1000px (large), 500px (medium), and 150px (small).
Example PHP Functions
The following very basic PHP functions aren't unlike the others we've provided that serve a similar purpose.
Return Photograph Details
Search Photograph Collection
Considerations
The source data itself (as opposed to the content) was a little crappy. A note of the SLQLD download page reads "when working with this dataset (CSV) in EXCEL you may find some irregularities with some of the data fields." Instead, they recommend use of an alternate text file that contains malformed (but easily parsed) XML data. However, there were numerous inconsistencies between both sources meaning we ended up dealing with the former. Because of our manual corrections, there may be slight errors in a very small number of results (maybe less than 15).
If you're one of our new Queensland clients (we've just opened up an office on the Gold Coast), talk to your relationship manager about how this data might be used in your social strategy.
Ensure you cache data locally so you don't make repeated and unnecessary requests.