Kehren Sie zurück zum Inhaltsverzeichnis, API

Tut uns leid, dieser Hilfe-Artikel ist zurzeit nicht in Deutsch verfügbar. Wenn Sie möchten, können Sie eine Übersetzung von Google versuchen.

/projects/:document_identifier/messages/:message_uuid

This resource supports the GET, PATCH, and DELETE methods.

URL Parameters

Label Description
:document_identifier The project's document identifier
:message_uuid The UUID of the message

GET

Returns information about the message.

Request Query String Parameters

Name Required Description
fields No A comma-separated list of the keys you want returned for the message. Default is to return all keys.

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

Response Body

A JSON object representing the message.

Key Value Description
uuid String The UUID of the message
date_created String The date and time the message was created, in ISO 8601 format
from_email String The "From" email address
from_name String The "From" name
subject String The subject
title String The title of the message (only displayed in Direct Mail)
automatic_text_content Boolean True if Direct Mail should automatically create the text content from the HTML content at send time. If false, the text_content property should be set.
content_type String Either text/html or text/plain
text_content String The plain-text content of the message
html_content String The HTML content of the message
text_encoding String If auto, then Direct Mail will infer the text encoding automatically, otherwise an IANA text encoding name
number_of_attachments Integer The number of attachments
number_of_headers Integer The number of extra message headers (does not include From or Subject headers)
links Array of Object URLs for the message (rel:self), its attachments (rel:attachments), and headers (rel:headers)

Example

GET /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/88EFF66F-5DC0-4290-930A-01365DDE448A 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 18:10:17 GMT
Content-Type: application/json; charset=utf-8

{
    "automatic_text_content": true,
    "content_type": "text/html",
    "date_created": "2015-04-22T18:07:37+0000",
    "from_email": "api-test@example.com",
    "from_name": "Joe User",
    "html_content": "<html><body>This is a test</body></html>",
    "links": [
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/88EFF66F-5DC0-4290-930A-01365DDE448A",
            "rel": "self"
        },
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/88EFF66F-5DC0-4290-930A-01365DDE448A/attachments",
            "rel": "attachments"
        },
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/88EFF66F-5DC0-4290-930A-01365DDE448A/headers",
            "rel": "headers"
        }
    ],
    "number_of_attachments": 0,
    "number_of_headers": 0,
    "subject": "Hello World!",
    "text_content": "This is the text that will appear if the recipient cannot view HTML messages. Replace this with a plain text version of your message.\n\nIf you want Direct Mail to create the plain text version for you automatically, uncheck Message > Content Type > Use Custom Plain-Text Alternative from the menu bar.",
    "text_encoding": "auto",
    "title": "My Newsletter",
    "uuid": "88EFF66F-5DC0-4290-930A-01365DDE448A"
}

PATCH

Updates the message.

Request Body

A JSON object representing the properties you want to update. You may update the following keys:

Key Required Value Description
from_email No String The "From" email address
from_name No String The "From" name
subject No String The subject
title No String The title of the message (only displayed in Direct Mail)
automatic_text_content No Boolean True if Direct Mail should automatically create the text content from the HTML content at send time. If false, the text_content property should be set.
content_type No String Either text/html or text/plain
text_encoding No String If auto, then Direct Mail will infer the text encoding automatically, otherwise an IANA text encoding name
text_content No String The plain text content of the message. Can be null or empty if automatic_text_content is true
html_content No String The HTML content of the message.

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 or the message is not editable
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

Response Body

A JSON object representing the merge task.

Key Value Description
links Array of Object URLs for the merge task and the updated resource.

Example

PATCH /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/1005CD6E-C284-410B-8AA4-947D174C69D4 HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Content-Type: application/json; charset=utf-8
Host: secure.directmailmac.com
Content-Length: 56

{
    "subject": "The new subject",
    "title": "April Newsletter"
}

HTTP/1.1 202 Accepted
Date: Wed, 22 Apr 2015 20:40:25 GMT
Content-Type: application/json; charset=utf-8

{
    "links": [
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/merge-task?s=23&m=PATCH&r=https%3A%2F%2Fsecure.directmailmac.com%2Fapi%2Fv2%2Fprojects%2F187812f26ba37d9769d8691d2a83c95c%2Fmessages%2F1005CD6E-C284-410B-8AA4-947D174C69D4",
            "rel": "merge-task"
        },
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/1005CD6E-C284-410B-8AA4-947D174C69D4",
            "rel": "resource"
        }
    ]
}

DELETE

Deletes the message.

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 or the message is not editable
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

Response Body

A JSON object representing the merge task.

Key Value Description
links Array of Object URL for the merge task.

Example

DELETE /api/v2/projects/187812f26ba37d9769d8691d2a83c95c/messages/1F45F495-7BEE-4DFF-9C9C-8ABE593F8A33 HTTP/1.1
Authorization: Basic QzFENDREMjEtNTA4MC00NTM3LUFFOD
Host: secure.directmailmac.com

HTTP/1.1 202 Accepted
Date: Wed, 22 Apr 2015 20:43:12 GMT
Content-Type: application/json; charset=utf-8

{
    "links": [
        {
            "href": "https://secure.directmailmac.com/api/v2/projects/187812f26ba37d9769d8691d2a83c95c/merge-task?s=26&m=DELETE&r=https%3A%2F%2Fsecure.directmailmac.com%2Fapi%2Fv2%2Fprojects%2F187812f26ba37d9769d8691d2a83c95c%2Fmessages%2F1F45F495-7BEE-4DFF-9C9C-8ABE593F8A33",
            "rel": "merge-task"
        }
    ]
}

Fanden Sie diesen Artikel hilfreich? Ja | Nein