Pages and securezones

    List the secure zones a page is added into

    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/pages/[page_id]/securezones
      • 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 securezones assigned to the page; each object has the following properties:

    • id - the id of the secure zone (integer)
    • siteId - the id of the site (integer)
    • landingPageId - the ID of the secure zone's landing page (string)
    • name - the name of the secure zone (string)
    • sellAccess - whether you charge the customers who get access to the secure zone or not (boolean)
    • costPerPeriod - the membership cost amount (integer)
    • orderCountryCode - the currency to use when charging the customers for access(string)
    • cycleType - the frequency of membership renewal (integer)
      • "1" Once
      • "2" Daily
      • "3" Weekly
      • "4" Fortnightly
      • "5" Monthly
      • "6" Quarterly
      • "7" Half Yearly
      • "8" Yearly

    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

    <pre></pre>
            
        <script>
            $(document).ready(function() {
              var access_token = BCAPI.Helper.Site.getAccessToken();
                    
                var request = $.ajax({
                    url: "/webresources/api/v3/sites/current/pages/9113941/securezones",
                    type: "GET",
                    connection: "keep-alive",    contentType: "application/json",
                    headers: {
                        "Authorization": $.cookie('access_token')
                    }
                });
                request.done(function (msg) {
                    console.log(msg);
                    $('pre').html(JSON.stringify(msg,null,2));
                })
                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);
                })
        </script>

    Sample response

    "items": [
        {
          "objectId": 9113941,
          "zoneId": 51,
          "objectType": 1,
          "displayable": 1,
          "siteId": 2073364,
          "secureZone": {
            "id": 51,
            "siteId": 2073364,
            "landingPageId": 0,
            "name": "Member Only Area",
            "sellAccess": false,
            "costPerPeriod": 0,
            "orderCountryCode": null,
            "cycleType": null,
            "createDate": "2015-05-12T01:28:40.117",
            "lastUpdateDate": "2015-05-12T01:28:40.117"
          }
        },
        {
          "objectId": 9113941,
          "zoneId": 9128,
          "objectType": 1,
          "displayable": 1,
          "siteId": 2073364,
          "secureZone": {
            "id": 9128,
            "siteId": 2073364,
            "landingPageId": 9017917,
            "name": "premium users",
            "sellAccess": false,
            "costPerPeriod": 0,
            "orderCountryCode": null,
            "cycleType": null,
            "createDate": "2015-05-12T17:00:01.843",
            "lastUpdateDate": "2015-05-12T17:00:01.843"
          }
        }
      ]

    Add a page to a secure zone

    Request

    • Method: POST
    • 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/pages/[page_ID]/securezones
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.
    • Data: This should contain a stringified, valid json object containing an array of objects with key "zoneId" and value of a valid secure zone id

    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
      
    
      var request = $.ajax({
          url: "/webresources/api/v3/sites/current/pages/9113941/securezones",
          type: "POST",
          mimeType: "application/json", 
          connection: "keep-alive",    contentType: "application/json",
          headers: {
              "Authorization": $.cookie('access_token')
          },
          processData: false,
          dataType: "html",
          data: JSON.stringify({
              "items": [{
                  "zoneId": 51
              }]                    
          })
      });
      
      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);
      })

    Response

    Returns an empty body if successful or a detailed error message.

    Accepts and returns JSON as Content-Type.

    Remove a page from a secure zone

    Request

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

    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
      
    
      var request = $.ajax({
          url:"/webresources/api/v3/sites/current/pages/9113941/securezones?items=[{'zoneId':51}]",
          type: "DELETE",
          mimeType: "application/json", 
          connection: "keep-alive",    
    contentType: "application/json", headers: { "Authorization": $.cookie('access_token') } }); request.done(function (msg) { $('pre').html(JSON.stringify(msg, null, 2)); 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); })

    Response

    Returns an empty body if successful or a detailed error message.