Retrieve All Userfield Category Data

Last modified on September 8, 2023 at 5:04 pm

Overview

To retrieve a list of all userfield categories you have defined, you may send a GET request to the userfieldcategories URL. This request follows standard practices for paging and filter restriction conventions. If no filtering restrictions are provided, the categories retrieved will include both public and private categories. The result of this GET request will be a JSON-encoded array of userfield categories. The object definition is provided below.

JSON Object Definition

The following is a full definition of all possible properties on the JSON object representing userfields categories. For a more detailed look at this object and its properties, see the Userfield Category Object Reference.

{
  "id": "",
  "type": "", // either "public" or "private"
  "name": "",
  "orderIndex": 0,
  "createdDate": ""
}

Filtering

Filtering the result list can be accomplished by specifying value restrictions for the following properties:

Parameter nameDetails
nameFilter based on a substring search of category names.
typeFilter based on the type of userfield category. If specified, this must either be public or private.
createdDateFilter based on the date the category was created. This must be a string representation of a date. This can be a precise timestamp, an imprecise date implying a range, or a range of dates. See the Date Filtering documentation for more detail.

Examples

This sample shows a response containing three userfields categories. The first two are public categories while the final category is private. The ordering is significant — public categories are all listed before the private categories, and within each type the categories are ordered by orderIndex.

Request
GET /dc/api/v5/userfields HTTP/1.1
Host: api.digitalchalk.com
Accept: application/json
Response
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 931

{
  "results": [
    {
      "id": "Office Position",
      "type": "public",
      "name": "Office Position",
      "orderIndex": 0,
      "createdDate": ""
    },
    {
      "id": "Biographical Information",
      "type": "public",
      "name": "Biographical Information",
      "orderIndex": 1,
      "createdDate": ""
    },
    {
      "id": "Campaign Tracking Data",
      "type": "private",
      "name": "Campaign Tracking Data",
      "orderIndex": 0,
      "createdDate": ""
    }
  ]
}