API

Newsletter statistics (multiple)

This example shows how you can retrieve the statistics of several campaigns.

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
details

See the fields below.

Required
listidsint

The comma-separated IDs of the mailing lists whose send statistics you want to retrieve. 'all' is for statistics of all lists.

Required
sortinfoint

See the fields below.

Optional
sortinfo.SortBystring

The order in which the statistics in the array must be sorted (starttime, finishtime).

Optional
sortinfo.Directionstring

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

Optional
countonlystring

Whether only the count must be returned. Default: false.

Optional
startint

Enter the number from which point the result must be returned. Default: 0 (first result).

Optional
perpagestring

The number of statistics to return per result. Choose 'all' for all opens. Default: 10

Optional
newsletteridint

The ID of the newsletter whose send statistics you want to retrieve.

Optional
newsletterid.DateSentSearch

The ID of the mailing list the contact is on.

Required
newsletterid.DateSentSearch.filterstring

This must be 1 in order to filter

Optional
newsletterid.DateSentSearch.typestring

This can be before, after, exact(ly), between, notbetween and not.

Optional
newsletterid.DateSentSearch.StartDatestring

The unix timestamp of the start date to search on.

Optional
newsletterid.DateSentSearch.EndDatestring

The unix timestamp of the end date to search on. You only specify this if between or notbetween was chosen as the type

Optional
useridint

The ID of the user whose send statistics you want to retrieve. You can only configure this with an admin API token

Optional
typestring

Here you can choose between newsletter, splittest or all. Default: newsletter

Optional

Successful response

Successful response
FieldTypeDescription
statusstring

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

dataint

If the statistics are found, the object is returned.

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>stats</requesttype>
	<requestmethod>GetNewsletterStats</requestmethod>
	<responsetype>xml</responsetype>
	<details>
		<listids>99</listids>
		<newsletterid>99</newsletterid>
		<sortinfo>
			<SortBy>finishdate</SortBy>
			<Direction>desc</Direction>
		</sortinfo>
		<searchinfo>
			<DateSentSearch>
				<filter>1</filter>
				<type>between</type>
				<StartDate>1662917256</StartDate>
				<EndDate>1726075656</EndDate>
			</DateSentSearch>
		</searchinfo>
		<start>0</start>
		<perpage>all</perpage>
		<type>newsletter</type>
	</details>
</xmlrequest>