GET/ email-messages/ :id/
Get single email message
You can return a specific email message.
| Attributes | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | A unique identifier for an email message automatically generated by User |
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/email-messages/:id/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/email-messages/:id/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/email-messages/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/email-messages/:id/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{
"id": 213,
"name": "Test message",
"subject": "Test message subject",
"created_at": "2016-09-19T09:08:53.125485Z",
"updated_at": "2016-09-19T10:25:43.460763Z",
"body_text": "My test email message",
"body_html": "<body><p>My test email message</p></body>",
"archived": false
}
{
"detail": "No EmailMessage matches the given query."
}
Response fields
Fields returned in the 200 OK response body.
| Field | Type | Description |
|---|---|---|
idinteger | integer | A unique identifier for the campaign which is given by User |
namestring | string | An email campaign name. |
subjectstring | string | Email subject line. |
body_textstring | string | Plain-text version of the message. |
body_htmlstring | string | HTML version of the message. |
archivedboolean | boolean | Whether the message is archived. |
created_atstring (date-time) | string (date-time) | A creation date of email campaign. |
updated_atstring (date-time) | string (date-time) | A last update of email campaign |
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.