2
2
* print-photo-info.c - Flickcurl example code to get information about a photo
4
* This is example code and not complete because the API Key, Shared
5
* Secret and Auth Token are not configured. The flickcurl utility
6
* in utils/flickcurl.c contains code that fully uses the API.
4
* This is example code and not complete because the OAuth client
5
* key, secret and the token and token secret are not configured.
7
* The flickcurl utility in utils/flickcurl.c contains code that
8
* fully uses the API and read/writes configuration from a file
9
* using flickcurl_config_var_handler()
8
11
* This file is in the Public Domain
28
31
flickcurl_init(); /* optional static initialising of resources */
31
/* Set configuration, or more likely read from a config file */
32
flickcurl_set_api_key(fc, "...");
33
flickcurl_set_shared_secret(fc, "...");
34
flickcurl_set_auth_token(fc, "...");
36
photo=flickcurl_photos_getInfo(fc, "123456789"); /* photo ID */
38
for(field_type=0; field_type <= PHOTO_FIELD_LAST; field_type++) {
39
flickcurl_field_value_type datatype=photo->fields[field_type].type;
34
/* Set configuration explicitly: ... */
35
flickcurl_set_oauth_client_key(fc, "...");
36
flickcurl_set_oauth_client_secret(fc, "...");
37
flickcurl_set_oauth_token(fc, "...");
38
flickcurl_set_oauth_token_secret(fc, "...");
40
/* or could read from an INI config file like this: */
42
flickcurl_config_read_ini(fc, "/home/user/.flickcurl.conf", "flickr",
43
fc, flickcurl_config_var_handler);
47
photo = flickcurl_photos_getInfo(fc, "123456789"); /* photo ID */
49
for(field_type = 0; field_type <= PHOTO_FIELD_LAST; field_type++) {
50
flickcurl_field_value_type datatype = photo->fields[field_type].type;
41
52
if(datatype != VALUE_TYPE_NONE)
42
53
fprintf(stderr, "field %s (%d) with %s value: '%s' / %d\n",
46
57
photo->fields[field_type].integer);
49
for(i=0; i < photo->tags_count; i++) {
60
for(i = 0; i < photo->tags_count; i++) {
50
61
flickcurl_tag* tag=photo->tags[i];
52
63
"%d) %s tag: id %s author ID %s name %s raw '%s' cooked '%s' count %d\n",