Photo Galleries Items

    List all items of a photo gallery

    Get all the items of a photo gallery.

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/photogalleries/[photogallery_ID]/items
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response body

    An array of the first 10 items; each object has the following properties:

    • id - photo gallery's item ID (number)
    • folderId - photo gallery's folder ID (number)
    • siteId - site ID (number)
    • name - path to filename (string)
    • size - size in kilobits (number)
    • description - item's description / caption (string)

    You can output additional fields to those listed above as default, see the API v3 Discovery APP for additional details.

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/photogalleries/4151/items",
        type: "GET",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    });
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    });

    Sample response

    {
      "items": [
        {
          "id": 44037076,
          "folderId": 4866666,
          "siteId": 1760549,
          "name": "11039939_931516763548589_1316328636_n.jpg",
          "size": 51496,
          "description": "This is a caption."
        },
        {
          "id": 44037077,
          "folderId": 4866666,
          "siteId": 1760549,
          "name": "11005927_931516720215260_713654233_n.jpg",
          "size": 54459,
          "description": "This is another caption."
        }
      ],
      "totalItemsCount": 2,
      "skip": 0,
      "limit": 10
    }

    Resource relationships

    List items with resources asociated with the photogallery by requesting these objects in the fields parameter:

    • folder
    • descriptionMetadata

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/photogalleries/[photogallery_ID]/items?fields=id,folderId,siteId,name,size,folder,descriptionMetadata
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response body

    An array of the first 10 items; each object has the following properties in addition to the default fields:

    • folder - item's folder object resource
      • id - folder's ID (number)
      • siteId - site ID (number)
      • parentId - folder's parent ID (number)
      • folderName - folder's name (string)
      • folderPath - folder's path (string)
    • descriptionMetadata - item's metadata object resource (null if item has not description)
      • fileName - item's filename (string)
      • siteId - site ID (number)
      • photoGalleryId - photo gallery ID (number)
      • description - item's description/caption (string)
      • createDate - item's metadata creation date (dateTime)
      • lastUpdateDate - item's metadata update date (dateTime)

    You can output additional fields to those listed above as default, see the API v3 Discovery APP for additional details.

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/photogalleries/4151/items?fields=id,name,folder,descriptionMetadata",
        type: "GET"
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    });
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    });

    Sample response

    {
      "items": [
        {
          "id": 44043154,
          "name": "item1.png",
          "folder": {
            "id": 4869750,
            "siteId": 1767665,
            "parentId": -1,
            "folderName": "img",
            "folderPath": "/img/"
          },
          "descriptionMetadata": null
        },
        {
          "id": 44043155,
          "name": "cards.png",
          "folder": {
            "id": 4869750,
            "siteId": 1767665,
            "parentId": -1,
            "folderName": "img",
            "folderPath": "/img/"
          },
          "descriptionMetadata": {
            "fileName": "item2.png",
            "siteId": 1767665,
            "photoGalleryId": 30847,
            "description": "Card caption",
            "createDate": "2016-04-18T11:41:27.6",
            "lastUpdateDate": "2016-04-18T11:41:27.6"
          }
        }
      ],
      "totalItemsCount": 2,
      "skip": 0,
      "limit": 10
    }