This example shows how you can create an HTML and/or text newsletter through the API.

Parameters

Parameters
FieldTypeDescriptionRequired / Optional
usernamestring

The username used to log in to MailCamp.

Required
usertokenstring

The unique token assigned to the user named above.

Required
requesttypestring

The name of the relevant API file.

Required
requestmethodstring

The name of the function being called.

Required
responsetypestring

The format of the response. This can be 'xml' or 'json'.

Optional
details

See the fields below.

Required
details.namestring

The name of the newsletter.

Required
details.formatstring

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.subjectstring

The subject of the newsletter. No more than 50 characters.

Required
details.textbodystring

The content of the newsletter in plain text format.

Required
details.htmlbodystring

The content of the newsletter in HTML format. Do not forget to add the CDATA tag

Required
details.createdateint

Enter the date as a unix timestamp.

Required
details.activeboolean

Use the value 1 to submit the newsletter as active. 0 is inactive.

Required
details.archiveboolean

Use the value 1 to add the newsletter to the newsletter archive.

Required
details.owneridint

Enter the ID of the user for whom the newsletter must be visible in MailCamp.

Required

Successful response

Successful response
FieldTypeDescription
statusstring

The value of the status field is returned as “SUCCESS” on a successful response.

dataint

The ID number of the newsletter.

Error response

Error response
FieldTypeDescription
statusstring

The value of the status field will be “FAILED”.

errormessagestring

A text message explaining why the request failed.

Request example
<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>