Events

    Get events

    Gets the list of event resources available.

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

    Response

    The details for the specified customer ID in JSON format.

    • id - the id of the event (integer)
    • siteId - the id of the site (integer)
    • name - the name of the customer Type (string)
    • body (string)
    • date (dateTime)
    • capacity (numeric)
    • hideWhenFull (boolean)
    • disabled (boolean)
    • deleted (boolean)
    • requiresPayment (boolean)
    • CreateDate (dateTime)
    • lastUpdateDate (dateTime)

    The response is paginated, you can return only a few of the customer's fields. Take a look at the API V3: sorting and filtering for additional switches you can use.

    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.


    Request:

    GET /webresources/api/v3/sites/current/bookings HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    

    Response:

    {
      "items": [
        {
          "id": 194481,
          "siteId": 246884,
          "name": "Store opening",
          "body": "
    Our store is opening today!
    
    \r\n
     
    
    \r\n
    \r\n    *  Required\r\n    \r\n        \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n            \r\n                \r\n            \r\n        \r\n    
    Title
    \r\n                
    First Name *
    \r\n                 
    Last Name *
    \r\n                 
    Email Address *
    \r\n                 
    Cell Phone Number *
    \r\n                
    {%bc_module module_ccsecurity%}
    
    \r\n    \r\n    \r\n
    \r\n",
          "date": "2014-01-05T23:00:00",
          "capacity": 50,
          "hideWhenFull": false,
          "disabled": false,
          "deleted": false,
          "requiresPayment": false,
          "CreateDate": "2013-12-16T10:50:11.2",
          "lastUpdateDate": "2013-12-16T12:39:05.253"
        },
        {
          "id": 194483,
          "siteId": 246884,
          "name": "After party",
          "body": "
    Join our after party.
    
    \n
     
    
    \n
    \n    *  Required\n    \n        \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n            \n                \n            \n        \n    
    Title
    \n                
    First Name *
    \n                 
    Last Name *
    \n                 
    Email Address *
    \n                 
    Cell Phone Number *
    \n                
    {%bc_module module_ccsecurity%}
    Payment Method *
    \n                Credit Card
    \n                Hosted Credit Card (remove if not required)
    \n                COD
    \n                PayPal
    \n                Gift Voucher
    Name on Card *
    \n                
    Card Number *
    \n                
    Card Expiry *
    \n                
    Card Type *
    \n                
    CCV Number *
    \n                
    Amount * 
    \n                
    
    \n    \n    \n
    \r\n",
          "date": "2013-12-16T23:00:00",
          "capacity": 20,
          "hideWhenFull": true,
          "disabled": false,
          "deleted": false,
          "requiresPayment": true,
          "CreateDate": "2013-12-16T13:02:34.07",
          "lastUpdateDate": "2013-12-16T13:22:04.867"
        }
      ],
      "totalItemsCount": 2,
      "skip": 0,
      "limit": 10
    }

    Sample code

    Get the list of events

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

    Get the details of a particular event

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

    Create a new event resource

    Using this method you can add an event's resource to your site.

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

    Parameters

    • id - the id of the event (integer)
    • siteId - the id of the site (integer)
    • name - the name of the customer Type (string)
    • body (string)
    • date (dateTime)
    • capacity (numeric)
    • hideWhenFull (boolean)
    • disabled (boolean)
    • deleted (boolean)
    • requiresPayment (boolean)
    • CreateDate (dateTime)
    • lastUpdateDate (dateTime)

    Response

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

    Accepts and returns JSON as Content-Type.


    Request:

    POST /webresources/api/v3/sites/current/bookings HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    
    
    {
          "id": 194481,
          "siteId": 246884,
          "name": "Store opening",
          "body": "Our store is opening today!",
          "date": "2014-01-05T23:00:00",
          "capacity": 50,
          "hideWhenFull": false,
          "disabled": false,
          "deleted": false,
          "requiresPayment": false,
          "CreateDate": "2013-12-16T10:50:11.2",
          "lastUpdateDate": "2013-12-16T12:39:05.253"
        }

    Response:

    
    HTTP/1.1 201 CREATED
    Location: /webresources/api/v3/sites/current/bookings/28742
    Content-Type: application/json; charset=utf-8
    Content-Length: length

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/bookings",
        data:{"name":"Store opening","body":"<p>Our store is opening today!</p>","date":"2014-01-05T23:00:00","capacity":50,"hideWhenFull":false,"disabled":false,"deleted":false,"requiresPayment":false,"CreateDate":"2013-12-16T10:50:11.2","lastUpdateDate":"2013-12-16T12:39:05.253"},
        type: "POST",    
        contentType: "application/json",
        headers: {
             "Authorization": BCAPI.Helper.Site.getAccessToken()
        }
    });
    request.done(function(data) {
        console.log(data);
    })
        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);
    })

    Edit an event resource

    Using this method you can edit an event resource

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

    Parameters

    • id - the id of the event (integer)
    • siteId - the id of the site (integer)
    • name - the name of the customer Type (string)
    • body (string)
    • date (dateTime)
    • capacity (numeric)
    • hideWhenFull (boolean)
    • disabled (boolean)
    • deleted (boolean)
    • requiresPayment (boolean)
    • CreateDate (dateTime)
    • lastUpdateDate (dateTime)

    Response

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

    Accepts and returns JSON as Content-Type.


    Request:

    PUT /webresources/api/v3/sites/current/bookings/28742 HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    
    
    {
          "id": 194481,
          "siteId": 246884,
          "name": "Store opening",
          "body": "Our store is opening today!",
          "date": "2014-01-05T23:00:00",
          "capacity": 50,
          "hideWhenFull": false,
          "disabled": false,
          "deleted": false,
          "requiresPayment": false,
          "CreateDate": "2013-12-16T10:50:11.2",
          "lastUpdateDate": "2013-12-16T12:39:05.253"
        }

    Response:

    
    HTTP/1.1 204 NO CONTENT
    Location: /webresources/api/v3/sites/current/bookings/194481
    Content-Type: application/json; charset=utf-8
    Content-Length: length

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/bookings/194481",
        data:{"capacity":50},
        type: "PUT",    
        contentType: "application/json",
        headers: {
             "Authorization": BCAPI.Helper.Site.getAccessToken()
        }
    });
    request.done(function(data) {
        console.log(data);
    })
        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 an event entity

    Delete an event entity.

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

    Response

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


    Request:

    DELETE /webresources/api/v3/sites/current/bookings/194481 HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    

    Response:

    
    HTTP/1.1 204 NO CONTENT
    Location: /webresources/api/v3/sites/current/bookings
    Content-Type: application/json; charset=utf-8
    Content-Length: length

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/bookings/194481",
        type: "DELETE",    
        contentType: "application/json",
        headers: {
             "Authorization": BCAPI.Helper.Site.getAccessToken()
        }
    });
    request.done(function(data) {
        console.log(data);
    })
        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);
    })