This example shows how you can retrieve all newsletters of a specific user.

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
requesttypeint

The name of the relevant API file.

Required
requestmethodint

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

The ID of the user whose newsletters you want to retrieve.

Required
details.sortinfo

See the fields below.

Required
details.sortinfo.SortBystring

The order in which the newsletters in the array must be sorted (Date, Subject, Name of Owner).

Required
details.sortinfo.directionstring

Whether sorting must be from low to high or the other way around (Down or Up).

Required
details.Startint

The first newsletter to start counting from.

Required
details.perpageint

The newsletters can be retrieved with pagination. This number is the number of newsletters per page.

Required
details.getLastSentDetailsboolean

Return the data of the last time the newsletters were sent.

Required

Successful response

Successful response
FieldTypeDescription
statusstring

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

newsletteridint

The ID number of the newsletter.

namestring

The name of the newsletter.

formatstring

The format of the newsletter (t = text, h = html, b = both/multipart).

subjectstring

The subject of the newsletter.

textbodystring

The text body of the newsletter.

htmlbodystring

The HTML body of the newsletter.

createdateint

The UNIX timestamp of the moment the newsletter was created.

activeint

Whether the status of the newsletter is active or not.

textbodystring

The text body of the newsletter.

archiveboolean

Whether the newsletter is in the RSS archive of the mailing list.

owneridint

The ID of the user who added the newsletter.

usernamestring

The username of the user.

fullnamestring

The full name of the user.

ownerstring

The name of the user.

queueidint

The ID created for the queue when sending.

jobidint

The ID created when sending.

starttimeint

The start time of sending the newsletter.

finishtimeint

The end time of sending the newsletter.

total_recipientsint

Total number of recipients of the newsletter.

sendsizeint

Send volume 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>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>