Users

    Get access token bearer's user

    List the attributes of the user for whom the access token (present in the Authorization header) was issued.

    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/users/me
      • 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 user (integer)
    • siteId - the ID of the site (integer)
    • email - the email of the user (string)
    • firstName - the first name of the user (string)
    • lastName - the last name of the user (string)
    • mobileNumber - mobile phone number of the user (string)
    • aliases - aliases of the user (string)
    • createDate - the creation date of the user (dateTime)
    • lastUpdateDate - the last update date of the user (dateTime)
    • catchAll - specifies if mails from alternate email are forwarded to the user's inbox. (boolean)
    • enabled - user enabled or not (boolean)
    • userTypeId - the user's role (integer)
      • 1 - Non-AdobeId
      • 5 - AdobeId
    • alternateEmail - the user's second, alternate email (string)

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

    Response:

    {
        "id": 54277,
        "siteId": 38581,
        "email": "my@mail.com",
        "firstName": "John",
        "lastName": "Doe",
        "mobileNumber": "+1111",
        "createDate": "2014-11-18T10:11:08.12",
        "lastUpdateDate": "2014-11-18T10:11:08.17",
        "catchAll": false,
        "enabled": true,
        "userTypeId": 1,
        "alternateEmail": null,
    }

    Sample code

    Get access token bearer's user

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

    List the attributes of a user.

    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/users/[ID]
      • 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 user (integer)
    • siteId - the ID of the site (integer)
    • email - the email of the user (string)
    • firstName - the first name of the user (string)
    • lastName - the last name of the user (string)
    • mobileNumber - mobile phone number of the user (string)
    • aliases - aliases of the user (string)
    • createDate - the creation date of the user (dateTime)
    • lastUpdateDate - the last update date of the user (dateTime)
    • catchAll - specifies if mails from alternate email are forwarded to the user's inbox. (boolean)
    • enabled - user enabled or not (boolean)
    • userTypeId - the user's role (integer)
    • alternateEmail - the user's second, alternate email (string)

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

    Response:

    {
        "id": 54277,
        "siteId": 38581,
        "email": "my@mail.com",
        "firstName": "John",
        "lastName": "Doe",
        "mobileNumber": "+1111",
        "createDate": "2014-11-18T10:11:08.12",
        "lastUpdateDate": "2014-11-18T10:11:08.17",
        "catchAll": false,
        "enabled": true,
        "userTypeId": 1,
        "alternateEmail": null,
    }

    Sample code

    Get access token bearer's user

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