Secure zones

    List the secure zones in a site

    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
      • 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 secure zones; 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
    • deleted - whether the secure zone is deleted or active (boolean)

    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/securezones",
        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": 3309,
          "siteId": 38581,
          "landingPageId": 4518247,
          "name": "Secure Zone 1",
          "sellAccess": false,
          "costPerPeriod": 0,
          "orderCountryCode": null,
          "cycleType": null,
          "deleted": false
        },
        {
          "id": 3310,
          "siteId": 38581,
          "landingPageId": 2411253,
          "name": "Secure Zone 2",
          "sellAccess": false,
          "costPerPeriod": 0,
          "orderCountryCode": null,
          "cycleType": null,
          "deleted": false
        },
        {
          "id": 3311,
          "siteId": 38581,
          "landingPageId": 2411253,
          "name": "Secure zone 3",
          "sellAccess": false,
          "costPerPeriod": 0,
          "orderCountryCode": null,
          "cycleType": null,
          "deleted": false
        }
      ],
      "totalItemsCount": 3,
      "skip": 0,
      "limit": 10
    }
    

    Get a secure zone's attributes

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

    Response

    Displays the details for the secure zone as a JSON object

    • 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
    • deleted - whether the secure zone is deleted or active (boolean)

    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/securezones/3309",
        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

    {
      "id": 3309,
      "siteId": 38581,
      "landingPageId": 4518247,
      "name": "Secure Zone 1",
      "sellAccess": true,
      "costPerPeriod": 1,
      "orderCountryCode": "AU",
      "cycleType": 5,
      "deleted": false
    }
    

    Create 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/securezones
      • 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 "201 created" if the secure zone was successfully created.

    Here are the parameters you can use when creating a secure zone:

    • 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

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
    	url: "/webresources/api/v3/sites/current/securezones",
        processData: false,
        data: JSON.stringify({
            "landingPageId": 4518247,
            "name": "Secure Zone 4 (API)",
            "sellAccess": true,
            "costPerPeriod": 1,
            "orderCountryCode": "AU",
            "cycleType": 1,
            "deleted": false
        }),
        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);
    })

    Update an existing secure zone

    Request

    • Method: PUT
    • 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/securezones/[secure_zone_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 secure zone was successfully modified.

    Here are the parameters you can use when updating a secure zone:

    • 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

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/securezones/3312",
        processData: false,
        data: JSON.stringify({
             "name": "Secure Zone 4 (API - modified)"
              }),
        type: "PUT",    
        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);
    })

    Delete a secure zone

    This section details the endpoints you can use to delete 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.
    • Path: /webresources/api/v3/sites/current/securezones/[seucre_zone_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 secure zone was successfully deleted.


    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/securezones/3312",
        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);
    })