Skip to content

Commit 9250ce8

Browse files
committed
Continue fixing API documentation discrepancies
- Add detailed Field Value Resource table with all attributes - Add Field Value Value Type table showing value formats - Add query parameters table for GET /field-values - Add payload parameters table for POST /field-values - Add path and payload parameters tables for PUT /field-values - Add path parameters table for DELETE /field-values - Enhance Field Value Changes supported types section - Fix field_id requirement note in GET /field-values-changes
1 parent 7a10e78 commit 9250ce8

1 file changed

Lines changed: 64 additions & 23 deletions

File tree

docs/v1/affinity_api_docs.md

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,19 +1222,42 @@ As an example for how a field value is created:
12221222

12231223
Each field value object has a unique id.
12241224

1225-
A field value also has field_id, entity_id, and list_entry_id attributes that give it the appropriate associations, as noted in the example above.
1225+
A field value resource has the following attributes:
12261226

1227-
Use the created_at and updated_at timestamps on field values to determine when the value(s) for a given field have last been added or changed. Please note that what might amount to an "update" in production may actually be a delete followed by a create in the API.
1227+
| Attribute | Type | Description |
1228+
|-----------|------|-------------|
1229+
| id | integer | The unique identifier of the field value object. |
1230+
| field_id | integer | The unique identifier of the field (column) that this value belongs to. |
1231+
| entity_id | integer | The unique identifier of the entity (person, organization, or opportunity) that this value is associated with. |
1232+
| list_entry_id | integer | The unique identifier of the list entry (row) that this value is associated with. This is null for global field values. |
1233+
| entity_type | integer | The type of entity (0=Person, 1=Organization, 8=Opportunity). |
1234+
| value_type | integer | The type of value stored. See [Field Value Value Type](#field-value-value-type) below. |
1235+
| value | varies | The actual value stored. The format depends on the value_type. See [Field Value Value Type](#field-value-value-type) below. |
1236+
| created_at | string | The timestamp when the field value was created. |
1237+
| updated_at | string | The timestamp when the field value was last updated. |
12281238

1229-
A field value can take on many different kinds of values, depending on the field value type (see Field section).
1239+
Use the created_at and updated_at timestamps on field values to determine when the value(s) for a given field have last been added or changed. Please note that what might amount to an "update" in production may actually be a delete followed by a create in the API.
12301240

1231-
Field
1241+
A field value can take on many different kinds of values, depending on the field value type (see [Field section](#field)).
12321242

12331243
> **Note**
12341244
> When retrieving Field Values from a specific cell in your Affinity list, it may be helpful to think about it as an XY coordinate system. The X coordinate is the List Entry or Entity and the Y coordinate is the Field.
12351245
12361246
#### Field Value Value Type
12371247

1248+
The value types below determine the format of the `value` attribute in a field value:
1249+
1250+
| Value Type | Description | Value Format |
1251+
|------------|-------------|--------------|
1252+
| Dropdown (2) | Dropdown option | Object with `id`, `text`, `rank`, `color` |
1253+
| Number (3) | Numeric value | Number (integer or float) |
1254+
| Person (0) | Person entity | Object with `id`, `type`, `first_name`, `last_name`, `primary_email`, `emails` |
1255+
| Organization (1) | Organization entity | Object with `id`, `name`, `domain`, `domains` |
1256+
| Location (5) | Location | String |
1257+
| Date (4) | Date | ISO 8601 formatted date string |
1258+
| Text (6) | Text string | String |
1259+
| Ranked Dropdown (7) | Ranked dropdown option | Object with `id`, `text`, `rank`, `color` |
1260+
12381261
The Field Types specified below correspond to the value_type of a field.
12391262

12401263
#### Get Field Value
@@ -1266,7 +1289,14 @@ GET /field-values Response:
12661289

12671290
Returns all field values attached to a person, organization, opportunity, or list_entry.
12681291

1269-
#### Query Parameter
1292+
#### Query Parameters
1293+
1294+
| Parameter | Type | Required | Description |
1295+
|-----------|------|----------|-------------|
1296+
| person_id | integer | custom* | The unique identifier of the person object. Exactly one of person_id, organization_id, opportunity_id, or list_entry_id must be specified. |
1297+
| organization_id | integer | custom* | The unique identifier of the organization object. Exactly one of person_id, organization_id, opportunity_id, or list_entry_id must be specified. |
1298+
| opportunity_id | integer | custom* | The unique identifier of the opportunity object. Exactly one of person_id, organization_id, opportunity_id, or list_entry_id must be specified. |
1299+
| list_entry_id | integer | custom* | The unique identifier of the list entry object. Exactly one of person_id, organization_id, opportunity_id, or list_entry_id must be specified. |
12701300

12711301
#### Return
12721302

@@ -1311,17 +1341,14 @@ curl "https://api.affinity.co/field-values?person_id=38706" -u :$APIKEY
13111341

13121342
Create a new field value with the supplied parameters.
13131343

1314-
field_id integer true The unique identifier of the field (column) that the field value is associated with.
1315-
1316-
entity_id integer true The unique identifier of the entity (person, organization, or opportunity) that the field value is associated with.
1317-
1318-
| This determine whether the fields objects is required. | field_id | The unique identifier of the fields (column) that the field value is associated with. | entity_id |
1319-
value custom true See the Field Value Resource section for all value type. The value specified must correspond to the value_type of the supplied fields. For ranked dropdowns fields like the default Sta
1320-
1321-
| The unique identifier of the entity (person, organization, or opportunity) that the field value is associated with. | value | custom | See the Field Value Resource section for all value type. The value specified must correspond to the value_type of the supplied fields. For ranked dropdowns fields like the default Status field, you must |
1322-
Field Value Resource
1344+
#### Payload Parameters
13231345

1324-
list_entry_id integer false The unique identifier of the list entry (list row) that the field value is associated with. Only specify the list_entry_id if the field that the field value is associated with is list-specific.
1346+
| Parameter | Type | Required | Description |
1347+
|-----------|------|----------|-------------|
1348+
| field_id | integer | true | The unique identifier of the field (column) that the field value is associated with. |
1349+
| entity_id | integer | true | The unique identifier of the entity (person, organization, or opportunity) that the field value is associated with. |
1350+
| value | custom | true | The value to store. The format must correspond to the value_type of the field. For ranked dropdown fields (like the default Status field), you must provide the dropdown option ID. See [Field Value Resource](#the-field-value-resource) section for value formats by type. |
1351+
| list_entry_id | integer | false | The unique identifier of the list entry (list row) that the field value is associated with. Only specify the list_entry_id if the field that the field value is associated with is list-specific. |
13251352

13261353
#### Return
13271354

@@ -1350,10 +1377,18 @@ curl -X POST "https://api.affinity.co/field-values" \
13501377

13511378
Update the existing field value with field_value_id with the supplied parameters.
13521379

1353-
#### value custom true See the Field Value Resource section for all value type. The value specified must correspond to the value_type of the supplied fields. For ranked dropdowns fields like the default Sta
1380+
#### Path Parameters
1381+
1382+
| Parameter | Type | Required | Description |
1383+
|-----------|------|----------|-------------|
1384+
| field_value_id | integer | true | The unique identifier of the field value object to update. |
13541385

1355-
| list_entry_id | The unique identifier of the list entry (lists row) that the field value is associated with. Only specify the list_entry_id if the fields that the field value is associated with is lists specific. | value | custom |
1356-
Field Value Resource
1386+
#### Payload Parameters
1387+
1388+
| Parameter | Type | Required | Description |
1389+
|-----------|------|----------|-------------|
1390+
| value | custom | true | The new value to store. The format must correspond to the value_type of the field. For ranked dropdown fields (like the default Status field), you must provide the dropdown option ID. See [Field Value Resource](#the-field-value-resource) section for value formats by type. |
1391+
| list_entry_id | integer | false | The unique identifier of the list entry (list row) that the field value is associated with. Only specify the list_entry_id if the field that the field value is associated with is list-specific. |
13571392

13581393
#### Return
13591394

@@ -1385,6 +1420,12 @@ curl -X PUT "https://api.affinity.co/field-values/20406836" \
13851420

13861421
Delete a field value with the specified field_value_id.
13871422

1423+
#### Path Parameters
1424+
1425+
| Parameter | Type | Required | Description |
1426+
|-----------|------|----------|-------------|
1427+
| field_value_id | integer | true | The unique identifier of the field value object to delete. |
1428+
13881429
#### Example Request
13891430

13901431
```bash
@@ -1415,14 +1456,14 @@ Fields that are automatically created and "enriched" by Affinity do not support
14151456

14161457
Among fields that are not enriched, only the ones with the following data types support change tracking:
14171458

1418-
#### Multi-valued Field
1459+
- **Multi-valued fields**: Fields where `allows_multiple` is `true` and the field has `track_changes` set to `true`
1460+
- **Single-valued fields**: Fields where `allows_multiple` is `false` and the field has `track_changes` set to `true`
14191461

1420-
#### Single-valued field
1462+
> **Note**
1463+
> Ranked dropdown fields (like Status fields) typically support change tracking.
14211464
14221465
> **Note**
1423-
> You can also see if a field does so by looking at the track_change attribute in the Field Resource. The API will return an appropriate error if the field doesn't support historical tracking.
1424-
>
1425-
> Field Resource
1466+
> You can also see if a field supports change tracking by looking at the `track_changes` attribute in the [Field Resource](#the-field-resource). The API will return an appropriate error if the field doesn't support historical tracking.
14261467
14271468
#### The Field Value Change Resource
14281469

0 commit comments

Comments
 (0)