FieldDefinition
A field definition represents a custom field -- its name, data type, etc.
Example Request
curl https://api.planningcenteronline.com/people/v2/field_definitions
Example Object
{
"type": "FieldDefinition",
"id": "1",
"attributes": {
"config": "string",
"data_type": "string",
"deleted_at": "2000-01-01T12:00:00Z",
"name": "string",
"sequence": 1,
"slug": "string",
"tab_id": "primary_key"
},
"relationships": {
"tab": {
"data": {
"type": "Tab",
"id": "1"
}
}
}
}
Attributes
| Name | Type | Description |
|---|---|---|
config |
string |
|
data_type |
string |
|
deleted_at |
date_time |
|
id |
primary_key |
|
name |
string |
|
sequence |
integer |
|
slug |
string |
|
tab_id |
primary_key |
Relationships
| Name | Type | Association Type | Note |
|---|---|---|---|
| tab | Tab | to_one |
Can Include
| Parameter | Value | Description | Assignable |
|---|---|---|---|
| include | field_options | include associated field_options |
|
| include | tab | include associated tab |
create and update |
Order By
| Parameter | Value | Type | Description |
|---|---|---|---|
| order | config | string | prefix with a hyphen (-config) to reverse the order |
| order | data_type | string | prefix with a hyphen (-data_type) to reverse the order |
| order | deleted_at | string | prefix with a hyphen (-deleted_at) to reverse the order |
| order | name | string | prefix with a hyphen (-name) to reverse the order |
| order | sequence | string | prefix with a hyphen (-sequence) to reverse the order |
| order | slug | string | prefix with a hyphen (-slug) to reverse the order |
| order | tab_id | string | prefix with a hyphen (-tab_id) to reverse the order |
Query By
| Name | Parameter | Type | Description | Example |
|---|---|---|---|---|
| config | where[config] |
string | Query on a specific config |
?where[config]=string |
| data_type | where[data_type] |
string | Query on a specific data_type |
?where[data_type]=string |
| deleted_at | where[deleted_at] |
date_time | Query on a specific deleted_at |
?where[deleted_at]=2000-01-01T12:00:00Z |
| name | where[name] |
string | Query on a specific name |
?where[name]=string |
| sequence | where[sequence] |
integer | Query on a specific sequence |
?where[sequence]=1 |
| slug | where[slug] |
string | Query on a specific slug |
?where[slug]=string |
| tab_id | where[tab_id] |
primary_key | Query on a specific tab_id |
?where[tab_id]=primary_key |
Pagination
| Name | Parameter | Type | Description |
|---|---|---|---|
| per_page | per_page | integer | how many records to return per page (min=1, max=100, default=25) |
| offset | offset | integer | get results from given offset |
Endpoints
Listing
| HTTP Method | Endpoint |
|---|---|
| GET | /people/v2/field_definitions |
Reading
| HTTP Method | Endpoint |
|---|---|
| GET | /people/v2/field_definitions/{id} |
Creating
| HTTP Method | Endpoint | Assignable Attributes |
|---|---|---|
| POST | /people/v2/tabs/{tab_id}/field_definitions |
|
Notes:
If you want to create a number type field, and you want to set a minimum or maximum value, you can pass a hash into the config attribute with the min and/or max keys:
"data": {
"attributes": {
"data_type": "number",
"name": "My Number Field",
"config": {
"min": "0",
"max": "100"
}
}
}
This example will create a number field that requires its value to be between 0 and 100.
Updating
| HTTP Method | Endpoint | Assignable Attributes |
|---|---|---|
| PATCH | /people/v2/field_definitions/{id} |
|
Notes:
Similarly to creating a number type field definition, you can update the config object of a number field definition to set a minimum or maximum value.
"data": {
"attributes": {
"config": {
"min": "0",
"max": "100"
}
}
}
This will update the field definition to require its value to be between 0 and 100.
Deleting
| HTTP Method | Endpoint |
|---|---|
| DELETE | /people/v2/field_definitions/{id} |
Notes:
Deleting a field definition internally sets its deleted_at attribute to the current time.
Associations
| HTTP Method | Endpoint | Returns | Details | Filter By |
|---|---|---|---|---|
| GET | https://api.planningcenteronline.com/people/v2/field_definitions/{field_definition_id}/field_options |
FieldOption | ||
| GET | https://api.planningcenteronline.com/people/v2/field_definitions/{field_definition_id}/tab |
Tab |
Belongs To
| HTTP Method | Endpoint | Association | Details | Filter By |
|---|---|---|---|---|
| GET | https://api.planningcenteronline.com/people/v2/field_data/{field_datum_id}/field_definition |
FieldDatum | ||
| GET | https://api.planningcenteronline.com/people/v2/field_definitions |
Organization |
|
|
| GET | https://api.planningcenteronline.com/people/v2/tabs/{tab_id}/field_definitions |
Tab |
|