API
Create
This example shows how you can create an HTML and/or text newsletter through the API.
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 | string | The name of the relevant API file. | Required |
requestmethod | string | 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.name | string | The name of the newsletter. | Required |
details.format | string | The format. This can be h (for HTML), t (for text/plain text) or b (for both). b is best, but you then have to submit both a text and an HTML version. | Required |
details.subject | string | The subject of the newsletter. No more than 50 characters. | Required |
details.textbody | string | The content of the newsletter in plain text format. | Required |
details.htmlbody | string | The content of the newsletter in HTML format. Do not forget to add the CDATA tag | Required |
details.createdate | int | Enter the date as a unix timestamp. | Required |
details.active | boolean | Use the value 1 to submit the newsletter as active. 0 is inactive. | Required |
details.archive | boolean | Use the value 1 to add the newsletter to the newsletter archive. | Required |
details.ownerid | int | Enter the ID of the user for whom the newsletter must be visible in MailCamp. | Required |
Successful response
| Field | Type | Description |
|---|---|---|
status | string | The value of the status field is returned as “SUCCESS” on a successful response. |
data | int | The ID number 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>Create</requestmethod>
<responsetype>xml</responsetype>
<details>
<name>Nieuwsbrief #1 2019</name>
<format>b</format>
<subject>dit is het onderwerp van de nieuwsbrief</subject>
<textbody>Dit is de text body</textbody>
<htmlbody><![CDATA[
<html><head></head><body>Dit is de html body</body>
]]></htmlbody>
<createdate>1356994800</createdate>
<active>1</active>
<archive>1</archive>
<ownerid>99</ownerid>
</details>
</xmlrequest>