Help Documentation 〉API 〉
/projects/:document_identifier/messages/:message_uuid/headers
This resource supports the GET and POST methods.
URL Parameters
Label |
Description |
:document_identifier |
The project's document identifier |
:message_uuid |
The UUID of the message |
GET
Returns an array of all the message headers.
GET Request Query String Parameters
Name |
Required |
Description |
fields |
No |
A comma-separated list of the keys you want returned for each header. Default is to return all keys. |
GET Response Status Codes
Code |
Description |
503 Service Unavailable |
Server is undergoing maintenance and is unavailable |
429 Rate Limited |
Rate limiting in effect, try again later |
404 Not Found |
The resource could not be found or your API key has not been granted access to it |
403 Forbidden |
Direct Mail account is disabled |
401 Unauthorized |
API key, secret, or authentication method is incorrect |
200 OK |
Success |
Name |
Description |
X-Total-Count |
The total number of headers |
GET Response Body
JSON representation of an array of objects. Each object in the array represents a message header. Please consult the /projects/:document_identifier/messages/:message_uuid/headers/:header_uuid
resource for a description of the object keys for each header.
GET Example
GET /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/F7ADD5FB-6AB3-49A7-AA2B-233A7C750FE7/headers HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Accept: application/json; charset=utf-8
Host: secure.directmailmac.com
HTTP/1.1 200 OK
Date: Wed, 22 Apr 2015 20:45:24 GMT
Content-Type: application/json; charset=utf-8
X-Total-Count: 1
[
{
"field": "Reply-To",
"links": [
{
"href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/F7ADD5FB-6AB3-49A7-AA2B-233A7C750FE7/headers/01FAD6FB-8C67-4270-84C3-6EC16B98178F",
"rel": "self"
}
],
"uuid": "01FAD6FB-8C67-4270-84C3-6EC16B98178F",
"value": "test-reply@example.com"
}
]
POST
Adds a new header to the message.
POST Request Body
A JSON object representing the message.
Key |
Required |
Value |
Description |
field |
Yes |
String |
The header field (e.g. "Cc", "Reply-To", etc.) |
value |
Yes |
String |
The header value |
POST Response Status Codes
Code |
Description |
503 Service Unavailable |
Server is undergoing maintenance and is unavailable |
429 Rate Limited |
Rate limiting in effect, try again later |
404 Not Found |
The project could not be found |
403 Forbidden |
Direct Mail account is disabled |
401 Unauthorized |
API key, secret, or authentication method is incorrect |
400 Bad Request |
One or more of the values in the request body is invalid |
202 Accepted |
The request has been accepted for processing |
POST Response Body
A JSON object representing the merge task.
Key |
Value |
Description |
links |
Array of Object |
URLs for the merge task and the inserted resource. |
POST Example
POST /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/F7ADD5FB-6AB3-49A7-AA2B-233A7C750FE7/headers HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Content-Type: application/json; charset=utf-8
Host: secure.directmailmac.com
Content-Length: 44
{
"field": "Cc",
"value": "test-cc@example.com"
}
HTTP/1.1 202 Accepted
Date: Wed, 22 Apr 2015 20:48:59 GMT
Content-Type: application/json; charset=utf-8
{
"links": [
{
"href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/merge-task?s=31&m=POST&r=https%3A%2F%2Fsecure.directmailmac.com%2Fapi%2Fv2%2Fprojects%2F187812f26ba37d9769d8691d2a83c95c%2Fmessages%2FF7ADD5FB-6AB3-49A7-AA2B-233A7C750FE7%2Fheaders%2F4AC4B981-6D2A-44C2-8636-B848472879A4",
"rel": "merge-task"
},
{
"href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/F7ADD5FB-6AB3-49A7-AA2B-233A7C750FE7/headers/4AC4B981-6D2A-44C2-8636-B848472879A4",
"rel": "resource"
}
]
}