API
Get newsletters
This example shows how you can retrieve all newsletters of a specific user.
Parameters
| Field | Type | Description | Required / Optional |
|---|---|---|---|
username | string | The username used to log in to MailCamp. | Required |
usertoken | string | The unique token assigned to the user named above. | Required |
requesttype | int | The name of the relevant API file. | Required |
requestmethod | int | The name of the function being called. | Required |
responsetype | string | The format of the response. This can be 'xml' or 'json'. | Optional |
details | See the fields below. | Required | |
details.ownerid | int | The ID of the user whose newsletters you want to retrieve. | Required |
details.sortinfo | See the fields below. | Required | |
details.sortinfo.SortBy | string | The order in which the newsletters in the array must be sorted (Date, Subject, Name of Owner). | Required |
details.sortinfo.direction | string | Whether sorting must be from low to high or the other way around (Down or Up). | Required |
details.Start | int | The first newsletter to start counting from. | Required |
details.perpage | int | The newsletters can be retrieved with pagination. This number is the number of newsletters per page. | Required |
details.getLastSentDetails | boolean | Return the data of the last time the newsletters were sent. | Required |
Successful response
| Field | Type | Description |
|---|---|---|
status | string | The value of the status field is returned as “SUCCESS” on a successful response. |
newsletterid | int | The ID number of the newsletter. |
name | string | The name of the newsletter. |
format | string | The format of the newsletter (t = text, h = html, b = both/multipart). |
subject | string | The subject of the newsletter. |
textbody | string | The text body of the newsletter. |
htmlbody | string | The HTML body of the newsletter. |
createdate | int | The UNIX timestamp of the moment the newsletter was created. |
active | int | Whether the status of the newsletter is active or not. |
textbody | string | The text body of the newsletter. |
archive | boolean | Whether the newsletter is in the RSS archive of the mailing list. |
ownerid | int | The ID of the user who added the newsletter. |
username | string | The username of the user. |
fullname | string | The full name of the user. |
owner | string | The name of the user. |
queueid | int | The ID created for the queue when sending. |
jobid | int | The ID created when sending. |
starttime | int | The start time of sending the newsletter. |
finishtime | int | The end time of sending the newsletter. |
total_recipients | int | Total number of recipients of the newsletter. |
sendsize | int | Send volume of the newsletter. |
Error response
| Field | Type | Description |
|---|---|---|
status | string | The value of the status field will be “FAILED”. |
errormessage | string | A text message explaining why the request failed. |
<xmlrequest>
<username>admin</username>
<usertoken>0123456789abcdef0123456789abcdef01234567</usertoken>
<requesttype>newsletters</requesttype>
<requestmethod>GetNewsletters</requestmethod>
<responsetype>xml</responsetype>
<details>
<ownerid>99</ownerid>
<sortinfo>
<SortBy>Date</SortBy>
<Direction>desc</Direction>
</sortinfo>
<start>0</start>
<perpage>10</perpage>
<getLastSentDetails>false</getLastSentDetails>
</details>
</xmlrequest>