RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

New South Wales Photography Collection (Pre 1955) API

New South Wales Photography Collection (Pre 1955) API

Whenever there's data available that provides content we consider suitable for our social media and marketing platform, we jump on it. One such collection of images (and one of many made available via our platform) is a database of NSW photographs taken prior to 1955, and made available by the State Library of NSW (via a Creative Commons Attribution 3.0 Australia licence ).

The quality of data provided by the State Library is a little appalling (as opposed to the content, which is excellent) and, not unlike their other data sources, there's no consistency in the way they make open data available. Dates aren't in a defined format and there's freehand notes throughout that makes parsing the data challenging. That said, we've ported the information over to a relational database and built an API that provides access to all data. This article describes rudimentary use of the the feature.

The Result

All data requests require an API key and a data type of either browse or search. When searching and browsing, a pg and number (of results) may also be passed as URL parameters to return the appropriate paginated result. In cases where a search is conducted, the search parameter should also be used.

http://api.beliefmedia.com/australia/nsw1955/nsw.json?apikey=xxx&pg=255 will return a JSON file that unfolds as follows. Only minimal data is returned in browsing and search results.

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => State Library of New South Wales, (Photographs of NSW life pre 1955)
7
    [page] => 255
8
    [number] => 30
9
    [pages] => 1264
10
    [total] => 37931
11
    [results] => Array
12
        (
13
            [0] => Array
14
                (
15
                    [itemid] => 25924
16
                     => Grace Bros staff ball
17
                    [collectiontitle] => Hood Collection part I : Sydney streets, buildings, people, activities and events, c.1925-1955
18
                    [creator] => NA
19
                    [dateofwork] => 1944
20
                    [year] => 1944
21
                    [images] => Array
22
                        (
23
                            [thumbnail] => http://acms.sl.nsw.gov.au/_DAMt/image/17/172/hood_21013t.jpg
24
                            [full] => http://acms.sl.nsw.gov.au/_DAMx/image/17/172/hood_21013h.jpg
25
                        )
26
 
27
                )
28
 
29
            [1] => Array
30
                (
31
                    [itemid] => 25935
32
                     => Grace Bros staff ball
33
                    [collectiontitle] => Hood Collection part I : Sydney streets, buildings, people, activities and events, c.1925-1955
34
                    [creator] => NA
35
                    [dateofwork] => 1944
36
                    [year] => 1944
37
                    [images] => Array
38
                        (
39
                            [thumbnail] => http://acms.sl.nsw.gov.au/_DAMt/image/17/172/hood_21017t.jpg
40
                            [full] => http://acms.sl.nsw.gov.au/_DAMx/image/17/172/hood_21017h.jpg
41
                        )
42
 
43
                )
44
 
45
            [ ... SNIP ... ]
46
 
47
            [29] => Array
48
                (
49
                    [itemid] => 25018
50
                     => Grace Bros staff from toy department (taken for Mr Hull)
51
                    [collectiontitle] => Hood Collection part I : Sydney streets, buildings, people, activities and events, c.1925-1955
52
                    [creator] => NA
53
                    [dateofwork] => 19/11/1941
54
                    [year] => 1941
55
                    [images] => Array
56
                        (
57
                            [thumbnail] => http://acms.sl.nsw.gov.au/_DAMt/image/17/171/hood_20593t.jpg
58
                            [full] => http://acms.sl.nsw.gov.au/_DAMx/image/17/171/hood_20593h.jpg
59
                        )
60
 
61
                )
62
 
63
        )
64
 
65
)

To return full details for a particular image, use the following: http://api.beliefmedia.com/australia/nsw1955/{api-key}/nsw-{itemid}.json. The JSON unfolds to a more detailed array.

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => State Library of New South Wales, (Photographs of NSW life pre 1955)
7
    [results] => Array
8
        (
9
            [itemid] => 23331
10
             => A Waltz Dream dress rehearsal
11
            [description] => A Waltz Dream dress rehearsal, 1/4/1939
12
            [collectiontitle] => Hood Collection part I : Sydney streets, buildings, people, activities and events, c.1925-1955
13
            [creator] => NA
14
            [dateofwork] => 1/4/1939
15
            [year] => 1939
16
            [reference] => Array
17
                (
18
                    [digitalordernumber] => hood_19040
19
                    [collectionitemlink] => 37473
20
                    [digitalitemlink] => 23331
21
                )
22
 
23
            [images] => Array
24
                (
25
                    [thumbnail] => http://acms.sl.nsw.gov.au/_DAMt/image/17/168/hood_19040t.jpg
26
                    [full] => http://acms.sl.nsw.gov.au/_DAMx/image/17/168/hood_19040h.jpg
27
                    [local] => yes
28
                )
29
 
30
            [places] => Array
31
                (
32
                    [0] => Array
33
                        (
34
                            [placename] => Sydney (N.S.W.)
35
                            [placeid] => 39802
36
                        )
37
 
38
                )
39
 
40
            [topics] => Array
41
                (
42
                    [0] => Array
43
                        (
44
                            [topicname] => theatres & cinemas
45
                            [topicid] => 4980
46
                        )
47
 
48
                    [1] => Array
49
                        (
50
                            [topicname] => theatrical costumes
51
                            [topicid] => 48513
52
                        )
53
 
54
                    [2] => Array
55
                        (
56
                            [topicname] => operettas
57
                            [topicid] => 49151
58
                        )
59
 
60
                    [3] => Array
61
                        (
62
                            [topicname] => dress rehearsals
63
                            [topicid] => 49471
64
                        )
65
 
66
                )
67
 
68
            [names] => Array
69
                (
70
                    [0] => Array
71
                        (
72
                            [name] => Australian and New Zealand Theatres Ltd
73
                            [nameid] => 94294
74
                        )
75
 
76
                    [1] => Array
77
                        (
78
                            [name] => A Waltz dream (theatrical production)
79
                            [nameid] => 94314
80
                        )
81
 
82
                )
83
 
84
        )
85
 
86
)

Much of the URL data provided by the SLNSW is no longer valid. For that reason, the reference data returns just the relevant ID rather than the full URL. The ID is more likely to be retained when the catalogue is rebuilt.

Searches

Searches may be made by text, topic, location, or name. Generally speaking, the data returned is virtually identical to the array returned via a browsing request. Documentation related to searches is found in our client area.

Images

In the images array there's a reference to local. The value of yes or no indicates whether we've cached a copy of the image on our server. If yes, the image may be returned with the following structure: {collectionitemlink}/{year}/{itemid}-{full|thumb}.jpg. If the local value is no it generally means that the image reference returned a 404 error.

You may download the complete image library from our client area (11.8GB, zip file). The directory structure for images is as described above.

Errors

If there's an error, the returned JSON data will return a code of something other than 200 with a descriptive message.

Sample PHP Function

The following example function will return an array of data.

1
<?php 
2
/*
3
 New South Wales Photography Collection (Pre 1955) API
4
 https://www.beliefmedia.com.au/nsw-history-photo-api
5
*/
6
 
7
function beliefmedia_slnsw_nsw_photos($page = '', $number = '', $search = false, $apikey = 'xxxxxxxxxxx') {
8
 
9
  if ($page == '') $page = '1';
10
  if ($number == '') $number = '20';
11
  $type = ($search !== false) ? 'search&search=' . $search : 'browse';
12
 
13
  $data = file_get_contents('http://api.beliefmedia.com/australia/nsw1955/nsw.json?apikey=' . $apikey . '&pg=' . $page . '&number=' . $number . '&type=' . $type);
14
  if ($data === false) return false;
15
 
16
  $data = json_decode($data, true);
17
  if ($data === false) return false;
18
 
19
  /* Likely return array of errors with code & message */
20
  if ($data['code'] != '200') return $data['message'];
21
 
22
 return (array) $data;
23
}

Too see the returned array, use echo print_r(beliefmedia_slnsw_nsw_photos(), true) wrapped in pre tags.

Considerations

  • We've made a simply little WordPress plugin that provides paginated results of photographs. This provides a nice little magnet for those clients where this style of information is appropriate. If you're a client (or former client) and would like it for your existing website, or a standalone website, please make contact with us.
  • The database is integrated into our social platform so any of the images and captions may be curated and sent to social. We've created a description field that morphs some of the data into a 'starting point' for captions.
  • If you're not a client and would like access, please make contact with us.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

RELATED READING

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment