Secure zones and pages

    List the pages in a particular secure zone

    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/securezones/[secure_zone_ID]/pages
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response

    An array of the first 10 web pages contained by the secure zone.

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


    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/securezones/3309/pages",
        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": [
        {
          "objectId": 2411253,
          "zoneId": 3309,
          "objectType": 1,
          "displayable": 1,
          "siteId": 38581,
          "page": {
            "id": 2411253,
            "siteId": 38581,
            "pageUrl": "/img/shipping/testurl123",
            "name": "Page1",
            "deleted": false,
            "categoryId": -1,
            "roleId": 10000,
            "templateId": 0,
            "parentId": 736557,
            "displayFileName": "testurl123.htm",
            "size": 202,
            "enabled": true,
            "startPage": false,
            "releaseDate": "2043-12-31T08:00:00",
            "expiryDate": "9999-01-01T00:00:00",
            "displayable": true,
            "excludeFromSearch": false,
            "livePageId": null,
            "content": "\n\n    \n    \n        \n        \n    \n    \n    Page 1 content -\n\n\n\r\n",
            "redirect301": "",
            "title": null,
            "seoMetadataDescription": null
          }
        },
        {
          "objectId": 4518424,
          "zoneId": 3309,
          "objectType": 1,
          "displayable": 1,
          "siteId": 38581,
          "page": {
            "id": 4518424,
            "siteId": 38581,
            "pageUrl": "/img/shipping/testurl123_copy",
            "name": "Page2",
            "deleted": false,
            "categoryId": -1,
            "roleId": 10000,
            "templateId": 0,
            "parentId": 736557,
            "displayFileName": "testurl123_copy.htm",
            "size": 203,
            "enabled": true,
            "startPage": false,
            "pageStatusId": 1,
            "releaseDate": "2043-12-31T08:00:00",
            "expiryDate": "9999-01-01T00:00:00",
            "displayable": true,
            "excludeFromSearch": false,
            "livePageId": null,
            "content": "\n\n    \n    \n        \n        \n    \n    \n    Page 2 content -\n\n\n\n\r\n",
            "redirect301": "",
            "title": null,
            "seoMetadataDescription": null
          }
        }
      ],
      "totalItemsCount": 2,
      "skip": 0,
      "limit": 10
    }
    

    Add pages to a secure zone

    Request

    • Method: POST
    • Version: v3
    • 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/[secure_zone_ID]/pages
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response

    The response should be "204 no content" if the page was successfully added to the secure zone.


    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
         url: "/webresources/api/v3/sites/current/securezones/3309/pages",
         processData: false,
         data: JSON.stringify({
              "items": [{
                "objectId": 4518424
              }]
            }),
        type: "POST",    
        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);
    })

    Remove pages from a secure zone

    Request

    • Method: DELETE
    • Version: v3
    • 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.a
    • Path: /webresources/api/v3/sites/current/securezones/[secure_zone_ID]/pages?items=[page1_ID,page2_ID,page3_ID]
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response

    The response should be "204 no content" if the pages were successfully removed from the the secure zone.


    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/securezones/3309/pages?items=[{'objectId':5463960,'zoneId':51,'objectType':1,'displayable':1}]]",
        type: "DELETE",    
        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);
    })