Anniversaries

    Get anniversaries

    Gets the list of anniversary 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/anniversaries
      • 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.

    • customerId - the id of the customer the anniversary is associated with (number)
    • siteId - the id of the site (number)
    • anniversary1 - the date of the anniversary (dateTime)
    • anniversary1Title the title of the anniversary (string)
    • anniversary2 - the date of the anniversary (dateTime)
    • anniversary2Title the title of the anniversary (string)
    • anniversary3 - the date of the anniversary (dateTime)
    • anniversary3Title the title of the anniversary (string)
    • anniversary4 - the date of the anniversary (dateTime)
    • anniversary4Title the title of the anniversary (string)
    • anniversary5 - the date of the anniversary (dateTime)
    • anniversary5Title the title of the anniversary (string)

    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/anniversaries HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    

    Response:

    {
      "items": [
        {
          "customerId": 61396913,
          "siteId": 246884,
          "anniversary1": "1968-03-20T23:00:00",
          "anniversary1Title": "Birthday",
          "anniversary2": null,
          "anniversary2Title": "",
          "anniversary3": null,
          "anniversary3Title": "",
          "anniversary4": null,
          "anniversary4Title": "",
          "anniversary5": null,
          "anniversary5Title": ""
        },
        {
          "customerId": 71151793,
          "siteId": 246884,
          "anniversary1": "1976-08-13T00:00:00",
          "anniversary1Title": "Birthday",
          "anniversary2": "2011-02-08T23:00:00",
          "anniversary2Title": "Wedding",
          "anniversary3": null,
          "anniversary3Title": "",
          "anniversary4": null,
          "anniversary4Title": "",
          "anniversary5": null,
          "anniversary5Title": ""
        }
      ],
      "totalItemsCount": 2,
      "skip": 0,
      "limit": 10
    }

    Sample code

    List all the CRM records with at least one anniversary set

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

    List all anniversary dates for a particular customer

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

    Using this method you can add an anniversary'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/anniversaries
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Parameters

    • anniversary1 - the date of the anniversary (dateTime)
    • anniversary1Title the title of the anniversary (string)
    • anniversary2 - the date of the anniversary (dateTime)
    • anniversary2Title the title of the anniversary (string)
    • anniversary3 - the date of the anniversary (dateTime)
    • anniversary3Title the title of the anniversary (string)
    • anniversary4 - the date of the anniversary (dateTime)
    • anniversary4Title the title of the anniversary (string)
    • anniversary5 - the date of the anniversary (dateTime)
    • anniversary5Title the title of the anniversary (string)

    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/anniversaries HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    
    
    {
      "customerId": 61396913,
      "siteId": 246884,
      "anniversary1": "1968-03-20T23:00:00",
      "anniversary1Title": "Birthday",
      "anniversary2": null,
      "anniversary2Title": "",
      "anniversary3": null,
      "anniversary3Title": "",
      "anniversary4": null,
      "anniversary4Title": "",
      "anniversary5": null,
      "anniversary5Title": ""
    }

    Response:

    
    HTTP/1.1 201 CREATED
    Location: /webresources/api/v3/sites/current/anniversaries/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/anniversaries",
        data:{"anniversary1":"1968-03-20T23:00:00","anniversary1Title":"Birthday","anniversary2":null,"anniversary2Title":"","anniversary3":null,"anniversary3Title":"","anniversary4":null,"anniversary4Title":"","anniversary5":null,"anniversary5Title":""},
        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 anniversary resource

    Using this method you can edit an anniversary 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/anniversaries/[customer-ID]
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Parameters

    • customerId - the id of the customer the anniversary is associated with (number)
    • siteId - the id of the site (number)
    • anniversary1 - the date of the anniversary (dateTime)
    • anniversary1Title the title of the anniversary (string)
    • anniversary2 - the date of the anniversary (dateTime)
    • anniversary2Title the title of the anniversary (string)
    • anniversary3 - the date of the anniversary (dateTime)
    • anniversary3Title the title of the anniversary (string)
    • anniversary4 - the date of the anniversary (dateTime)
    • anniversary4Title the title of the anniversary (string)
    • anniversary5 - the date of the anniversary (dateTime)
    • anniversary5Title the title of the anniversary (string)

    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/anniversaries/28742 HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    
    
    {
      "customerId": 61396913,
      "siteId": 246884,
      "anniversary1": "1968-03-20T23:00:00",
      "anniversary1Title": "Birthday",
      "anniversary2": null,
      "anniversary2Title": "",
      "anniversary3": null,
      "anniversary3Title": "",
      "anniversary4": null,
      "anniversary4Title": "",
      "anniversary5": null,
      "anniversary5Title": ""
    }

    Response:

    
    HTTP/1.1 204 NO CONTENT
    Location: /webresources/api/v3/sites/current/anniversaries/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/anniversaries/61396913",
        data:{"anniversary1":"1968-03-20T23:00:00"},
        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 anniversary entity

    Delete an anniversary 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/anniversaries/[customer-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/anniversaries/9593213 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/anniversaries
    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/anniversaries/61396913",
        type: "DELETE",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    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);
    })