Skip to content
Maxim Kramarenko edited this page Jun 9, 2014 · 1 revision

REST API

To index messages

Execute the PUT request with URL like http://localhost:8080/rest/index and the following content

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageCollection>
<messages>
	<customerId>test-4</customerId>
	<domainId>def.com</domainId>
	<msgId>12666087186921458414313807249233</msgId>
	<receiveTimestamp>1266608718692</receiveTimestamp>
	<deliveryTimestamp>1266608718692</deliveryTimestamp>
	<fromEmail>hexadecimal@hikers.com</fromEmail>
	<toEmail>infinitesimals@abc.com</toEmail>
	<envFromEmail>hexadecimal@hikers.com</envFromEmail>
	<envToEmail>infinitesimals@abc.com</envToEmail>
	<subject>hurricanes immature incestuousimpetus</subject>
	<size>54298</size>
	<tags>AT750 SS1</tags>
	<senderIP>192.168.99.249</senderIP>
	<recipientIP>192.168.231.208</recipientIP>
	<acceptLine>250 accepted from queue 7287644792245643925</acceptLine>
	<fileName>http://localhost:9090/temp/license.html:10:200</fileName>
	<virus>name</virus>
    <note>note</note>
</messages>
<messages>
	...
</messages>
</MessageCollection>

The following fields should/can be transferred in encoded form: msgId,fromEmail, toEmail, subject, acceptLine, virus

To search messages by params

Execute the following PUT application/*+json request http://localhost:8080/rest/search/<customerId>

Optional params:

  • start=0
  • howMany=20
  • login=guest
  • password=guest

with the following content

{"searchTimestamp":null,"domainId":"10","msgId":"long-msg-id","fromEmail":"from@mail.com","toEmail":"to@mail.com",
"envFromEmail":"","envToEmail":"","subject":"hockey","fullText":"","fromDate":0,"toDate":0,"actionType":"AT300",
"spamScore":"SS5","direction":"D0","senderIP":"127.0.0.1","recipientIP":"192.168.1.1","acceptLine":"",
"virus":"vir"}

You can also set only required fields:

{"domainId":"10"}

User means fromEmail OR toEmail.

queryParser syntax described there: http://lucene.apache.org/java/3_0_0/queryparsersyntax.html

To get autocomplete suggestions

Use the following GET request http://localhost:8080/rest/search/autocomplete/<customerId>?field=subject&prefix=hock

Optional params are:

  • start=0
  • howMany=20
  • login=guest
  • password=guest

To shutdown server

Execute the following GET request http://localhost:8080/rest/index/shutdown

  • login=root
  • password=root

Only root can execute this request.

Spam report per toEmail

http://localhost:8080/rest/report/spam/<customer id>

http://localhost:8080/rest/report/spam/<customer id>/<domain id>

Optional params:

  • currentTimeStamp=0
  • login=guest
  • password=guest

Delivery time distribution report

http://localhost:8080/rest/report/delivery/<customer id> http://localhost:8080/rest/report/delivery/<customer id>/<domain id>

Optional params:

  • lastDays=30
  • login=guest
  • password=guest

Message throughput report

http://localhost:8080/rest/report/stats http://localhost:8080/rest/report/stats/<customer id>

Optional params:

  • login=guest
  • password=guest

Top customers report

http://localhost:8080/rest/report/top

Optional params:

  • howMany=20
  • login=guest
  • password=guest

Action type per toEmail distribution report

http://localhost:8080/rest/report/recipientTag/<customerId> Optional params:

  • login=guest
  • password=guest

Total report

http://localhost:8080/rest/report/total/<customerId>

Optional params:

  • login=guest
  • password=guest

Copy all messages with specified domain from one customer to another

http://localhost:8080/rest/management/copyDomain/<customerId>?targetCustomer=<targetCustomerId>&domain=<domain>

To create snapshot

http://localhost:8080/rest/report/mailInQueueSnapshot/<customerId> You should get virtual customer id, that can be used in further search requests.