Get Web App Custom Field Details

Returns a field definition.

Request

  • Method: GET
  • 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: /api/v2/admin/sites/current/webapps/[webappName]/fields/[fieldId]
  • Authorization header: This should contain the authorization token. Here is how to obtain the token.
  • Required Permissions: View Web Apps

Response

An object, similar to the ones in the List API.

Examples

Accepts and returns JSON as Content-Type.


Request:

GET /api/v2/admin/sites/current/webapps/WEBAPP_NAME_HERE/fields/CUSTOM_FIELD_ID_HERE HTTPS/1.1
Authorization: 7e04176165cd4df7b628cc8ad022a8becf3bb84de44d480aadfae75e4fa07b56
Content-Type: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 145

{
      "id"      : "418191",
      "name"    : "Part code",
      "type"    : "String",
      "listItems": null,
      "dataSource": null,
      "required": false,
      "order"   : 1
}

Sample code

var request = $.ajax({
    url: "/api/v2/admin/sites/current/webapps/test app2/fields/12345",
    type: "GET",
    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);
})


Error codes

This method will return the following error codes:

  • 200 - success
  • 400 - bad request; sub-error codes:
    • 210000 - An unspecified error has occurred
  • 401 - unauthorized - when the authentication token is incorrect
    • 101000 - sub-error code
  • 403 - forbidden - when the user does not have View WebApps Permission
  • 404 - not found
    • 190001 - The web app could not be found (the webAppName param from the URL does not match)
    • 210001 - The custom field was not found (the fieldId from the URL do not match)