Date Field Value
A date field value consists of its value
property which holds a start date and optionally an end date. A start date has the properties start
(datetime string), start_date
(date string), start_time
(HH:mm:ss formatted string), an end date is structured in the same way. A single_date
field value can only hold a start date while a range_date
field value can hold an additional end date.
More details on date and datetime strings can be found here.
Record creation
A date field value can be created as part of a record creation. Here is an example request body for creating a record with a value for the "Date of employment" field with ID 2, type single_date
and external ID date_of_employment
and a value for the "Onboarding week" field with ID 3, type range_date
and external ID onboarding_week
:
- cURL
- JSON
curl -X POST https://api.tapeapp.com/v1/record/app/1 \
-u user_key_replace_with_your_api_key: \
-H "Content-Type: application/json" \
--data '{
"fields": {
"date_of_employment": "2022-03-01",
"onboarding_week": "2022-03-07 - 2022-03-14"
}
}'
{
"fields": {
"date_of_employment": "2022-03-01",
"onboarding_week": "2022-03-07 - 2022-03-14"
}
}
{
"record_id": 1,
"title": "Tuesday, 1. March 2022",
"fields": [
{
"field_id": 2,
"external_id": "date_of_employment",
"label": "Date of employment",
"type": "date",
"field_type": "single_date",
"values": [
{
"start": "2022-03-01 00:00:00",
"start_date": "2022-03-01",
"start_time": null,
"start_utc": "2022-03-01 00:00:00",
"start_date_utc": "2022-03-01",
"start_time_utc": null
}
]
},
{
"field_id": 3,
"external_id": "onboarding_week",
"label": "Onboarding week",
"field_type": "range_date",
"type": "date",
"values": [
{
"start": "2022-03-07 00:00:00",
"start_date": "2022-03-07",
"start_time": "00:00:00",
"start_utc": "2022-03-07 00:00:00",
"start_date_utc": "2022-03-07",
"start_time_utc": "00:00:00",
"end": "2022-03-14 00:00:00",
"end_date": "2022-03-14",
"end_time": "00:00:00",
"end_utc": "2022-03-14 00:00:00",
"end_date_utc": "2022-03-14",
"end_time_utc": "00:00:00"
}
]
}
]
}
Record retrieval
A date field value can be retrieved as part of a record retrieval:
curl https://api.tapeapp.com/v1/record/1 \
-u user_key_replace_with_your_api_key:
{
"record_id": 1,
"title": "Tuesday, 1. March 2022",
"fields": [
{
"field_id": 2,
"external_id": "date_of_employment",
"label": "Date of employment",
"type": "date",
"field_type": "single_date",
"values": [
{
"start": "2022-03-01 00:00:00",
"start_date": "2022-03-01",
"start_time": null,
"start_utc": "2022-03-01 00:00:00",
"start_date_utc": "2022-03-01",
"start_time_utc": null
}
]
},
{
"field_id": 3,
"external_id": "onboarding_week",
"label": "Onboarding week",
"field_type": "range_date",
"type": "date",
"values": [
{
"start": "2022-03-07 00:00:00",
"start_date": "2022-03-07",
"start_time": "00:00:00",
"start_utc": "2022-03-07 00:00:00",
"start_date_utc": "2022-03-07",
"start_time_utc": "00:00:00",
"end": "2022-03-14 00:00:00",
"end_date": "2022-03-14",
"end_time": "00:00:00",
"end_utc": "2022-03-14 00:00:00",
"end_date_utc": "2022-03-14",
"end_time_utc": "00:00:00"
}
]
}
]
}
Record update
One or more date field values can be updated as part of a record update. Here is an example request body for updating multiple date field values of a record:
- cURL
- JSON
curl -X PUT https://api.tapeapp.com/v1/record/1 \
-u user_key_replace_with_your_api_key: \
-H "Content-Type: application/json" \
--data '{
"fields": {
"date_of_employment": "2022-03-02",
"onboarding_week": "2022-03-08 - 2022-03-15"
}
}'
{
"fields": {
"date_of_employment": "2022-03-02",
"onboarding_week": "2022-03-08 - 2022-03-15"
}
}
{
"record_id": 1,
"title": "Wednesday, 2. March 2022",
"fields": [
{
"field_id": 2,
"external_id": "date_of_employment",
"label": "Date of employment",
"type": "date",
"field_type": "single_date",
"values": [
{
"start": "2022-03-02 00:00:00",
"start_date": "2022-03-02",
"start_time": null,
"start_utc": "2022-03-02 00:00:00",
"start_date_utc": "2022-03-02",
"start_time_utc": null
}
]
},
{
"field_id": 3,
"external_id": "onboarding_week",
"label": "Onboarding week",
"field_type": "range_date",
"type": "date",
"values": [
{
"start": "2022-03-08 00:00:00",
"start_date": "2022-03-08",
"start_time": "00:00:00",
"start_utc": "2022-03-08 00:00:00",
"start_date_utc": "2022-03-08",
"start_time_utc": "00:00:00",
"end": "2022-03-15 00:00:00",
"end_date": "2022-03-15",
"end_time": "00:00:00",
"end_utc": "2022-03-15 00:00:00",
"end_date_utc": "2022-03-15",
"end_time_utc": "00:00:00"
}
]
}
]
}