patch_data_requests
PATCH /data_requests/:feedback_id
Updates or appends segments and updates respondent contact information (email, phone_number) for the provided feedback (GDPR right to rectification).
- Partial update: Only the attributes and segments specified in the request are modified; any existing segments or attributes remain untouched.
- Auto-create segments: If a specified segment is not yet present on the feedback, it is automatically added (unless company has managed segments enabled).
- HTTP Methods: Supports both
PATCHandPUT.
Endpoints
PATCH /api/v1/data_requests/:feedback_idPATCH /api/v1/data_requests?filter[feedback_id]=:feedback_idPATCH /api/v1/data_requests/:data_subject/:feedback_id: (legacy)
Request Examples
- cURL
- Rails
curl -X PATCH 'https://api.diduenjoy.com/api/v1/data_requests/PUT-YOUR-FEEDBACK-ID' \
-u 'PUT-YOUR-API-KEY-HERE:' \
-H 'Content-Type: application/json' \
-d '{
"email": "updated@example.com",
"segments": {
"store": "Paris",
"vip": "true"
}
}'
require 'rest-client'
require 'json'
feedback_id = 'PUT-YOUR-FEEDBACK-ID'
RestClient::Request.execute method: :patch,
url: "https://api.diduenjoy.com/api/v1/data_requests/#{feedback_id}",
user: 'PUT-YOUR-API-KEY-HERE',
headers: { content_type: :json },
payload: {
email: 'updated@example.com',
segments: {
store: 'Paris',
vip: 'true'
}
}.to_json
Payload Examples
- Single Segment
- Multiple Segments
- Contact Info
- Append Mode
- JSON:API Format
Updates or adds a single segment (defaults to replace mode):
{
"segments": {
"store": "Paris"
}
}
Updates or adds multiple segments in a single call:
{
"segments": {
"store": "Paris",
"tier": "gold",
"optin": "yes"
}
}
Updates respondent email or phone number:
{
"email": "updated@example.com",
"phone_number": "+33600000000"
}
Appends the new value to the existing segment value using the specified separator (e.g. "Value 1;Value 2"). If the segment has no previous value, the new value is set without a leading separator:
{
"segments": {
"tags": "VIP"
},
"update_mode": "append",
"separator": ";"
}
JSON:API format is also supported:
{
"data": {
"type": "data_requests",
"attributes": {
"email": "updated@example.com",
"segments": {
"store": "Paris"
},
"update_mode": "replace"
}
}
}
Attributes
| attribute | type | description |
|---|---|---|
| segments | hash { string: string } | Optional. Key-value pairs of segments to update or add. |
| string | Optional. Update respondent email address. | |
| phone_number | string | Optional. Update respondent phone number. |
| update_mode | string | Optional. Update mode: replace (default) or append. |
| separator | string | Optional. Separator when update_mode is append. Accepted values: ; (default) or ,. |
note
- If the company has managed segments enabled, all segment keys provided must already exist in the company's segments list.
- When using the legacy
:data_subjectroute (/api/v1/data_requests/:data_subject/:feedback_id),emailandphone_numbercannot be updated if:data_subjectdoes not match the survey's data subject.
Possible data_subject values (legacy)
contractorcustomeremployeeotherprospectsuppliersto_be_definedtraineevisitor
Status Codes
| status | description |
|---|---|
| 200 OK | Resource updated and returned successfully. |
| 401 Unauthorized | Missing or invalid API key. |
| 404 Not Found | Feedback not found or does not belong to the company. |
| 422 Unprocessable Content | Validation error: missing feedback_id, invalid update_mode (only replace or append), invalid separator (only ; or ,), segment not allowed by managed segments, or attribute does not match data_subject. |