Anda di halaman 1dari 13

RedFlagDeals.

com Message Centre API

With the help of this document you can easily query the RedFlagDeals.com Messaging Centre database through our
API. We suggest you print this document and keep it for future reference.

This document was last updated August 17, 2010 and is applicable to version 1 of the API.

Technical Contact Information

For technical issues, please contact Kaitlyn McLachlan directly:


Phone: (416) 628-3331 x112
Email: Kaitlyn.McLachlan@ypg.com

Important Information

All API calls are logged


All API calls must include your unique API key. This key must be kept secret as it belongs to ONLY YOU.
API calls will be performed by making a POST request in the following format:
Test (non-HTTPS): http://forums-dev.redflagdeals.com/api/api.php
Live (HTTPS): https://forums.redflagdeals.com/api/api.php
The following fields must be submitted with every request:
cmd=[command]
key=[your api key]
version=[api version]
Any additional required and/or optional parameters will be outlined in their respective section.
The order in which parameters are sent does not matter
Cookies will be sent from the API system which should be accepted, stored and sent in subsequent requests
Handling Errors

If there are any errors with the request or issues processing the values of the request, an ErrorResponse XML will
be returned.

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse>
<ErrorCode>10001</ErrorCode>
<ErrorMessage>Not logged in</ErrorMessage>
</ErrorResponse>

Some errors are more generic and will not have a matching ErrorCode. Any ErrorCode under 10000 should be
ignored and treated as generic.
List of API Commands

Command Description

login Process the login routine for an account

msg_list Fetch a list of messages

msg_details Fetch information for a specific message

NOT YET IMPLEMENTED


msg_delete
Delete a message

msg_send Send a message

folder_list Fetch a list of folders for the user's mailbox

user_search Perform a username search (for autocompletion/name checking)


API Command Calls

login

Login Request Fields


Field Description Default Data Type Required?

username Account username - String Yes

password Password for account - String Yes

Login Response Fields


Field Description

The result of the login. This will always be 1 as a failed login will generate an
LoginResult
ErrorResponse XML response

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<LoginResponse>
<LoginResult>1</LoginResult>
</LoginResponse>
msg_list

Message List Request Fields


Data
Field Description Default Restrictions Required?
Type

0, unless searchuser or
The folder to list searchtitle is set (it
folderid Integer - No
messages for then defaults to "all
folders")

String to search
searchuser - String - No
by username

String to search
searchtitle by message - String - No
subject

# of messages
Automatically chosen based
perpage to return per Integer - No
on size of a specific folder
request

page Page number 1 Integer - No

Must be one
of:
sort Field to sort on. date String date No
title
sender

Must be one
Ordering of
of:
order results on the desc String No
asc
sort
desc

Message List Response Fields


Field Description

Folders Container for one or more Folder elements

Pagination The Pagination element.

Messages Container for one or more Message elements.

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<MessageListResponse>
<Folders>
<Folder id="0">
<Name>Inbox</Name>
<TotalMessages>2</TotalMessages>
<Selected>true</Selected>
</Folder>
<Folder id="-1">
<Name>Sent Items</Name>
<TotalMessages>3</TotalMessages>
<Selected>false</Selected>
</Folder>
</Folders>
<Pagination>
<CurrentPage>1</CurrentPage>
<TotalPages>1</TotalPages>
<PerPage>2</PerPage>
<Total>2</Total>
<Returned>2</Returned>
</Pagination>
<Messages>
<MessageGroup label="Today">
<Message id="10135604">
<FolderId>0</FolderId>
<Subject>Test Message</Subject>
<Preview>This is just a test...</Preview>
<Body><!--Not shown in sample --></Body>
<Date>
<Timestamp>1281721111</Timestamp>
<Display>1 hour ago</Display>
</Date>
<From>
<User id="226512">Kaitlyn</User>
</From>
<To>
<User id="23921">GregLovesDeals</User>
</To>
<Cc/>
<Bcc>
<User id="42124">DavidDaGreat</User>
</Bcc>
</To>
<Status>1</Status>
</Message>
<Message id="10135600">
<FolderId>0</FolderId>
<Subject>Test Message!</Subject>
<Preview>This is a test message!! Hello test messsssageee</Preview>
<Body><!--Not shown in sample --></Body>
<Date>
<Timestamp>1281721073</Timestamp>
<Display>1 hour ago</Display>
</Date>
<From>
<User id="226512">Kaitlyn</User>
</From>
<To>
<User id="23921">GregLovesDeals</User>
</To>
<Cc />
<Bcc />
msg_details

Message Details Request Fields


Field Description Default Data Type Required?

pmid The message id - Integer Yes

Message Details Response Fields


Field Description

Message The Message element

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<MessageDetailsResponse>
<Message id="10135604">
<FolderId>0</FolderId>
<Subject>Test Message</Subject>
<Preview>This is just a test...</Preview>
<Body><!--Not shown in sample --></Body>
<Date>
<Timestamp>1281721111</Timestamp>
<Display>1 hour ago</Display>
</Date>
<From>
<User id="226512">Kaitlyn</User>
</From>
<To>
<User id="23921">GregLovesDeals</User>
</To>
<Cc/>
<Bcc>
<User id="42124">DavidDaGreat</User>
</Bcc>
<Status>0</Status>
</Message>
</MessageListResponse>
msg_send

Message Send Request Fields


Data
Field Description Default Restrictions Required?
Type

The message id that is being


pmid 0 Integer - No
replied to or forwarded

Indicator of whether or not Either 0 (no) or 1


forward 0 Integer No
message is being forwarded (yes)

One of more recipients Max of 5 recipients


recipients - String Yes
separated by a semicolon + bccrecipients

Optional list of recipients to


Max of 5 recipients
bccrecipients blind carbon copy, separated - String No
+ bccrecipients
by semicolons

title Subject of message - String 85 characters max Yes

message Message body - String - Yes

Message Send Response Fields


Field Description

This will always be 1 as any other result will generate an ErrorResponse XML
SendResult
response

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<MessageSendResponse>
<SendResult>1</SendResult>
</MessageSendResponse>
folder_list

Folder List Request Fields


There are no request fields for this call

Folder List Response Fields


Field Description

Container for one or more Folder elements. Please note that the Selected element will
Folders
always be false for this call.

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<FolderListResponse>
<Folders>
<Folder id="0">
<Name>Inbox</Name>
<TotalMessages>2</TotalMessages>
<Selected>false</Selected>
</Folder>
<Folder id="-1">
<Name>Sent Items</Name>
<TotalMessages>3</TotalMessages>
<Selected>false</Selected>
</Folder>
<Folder id="1">
<Name>Important Messages</Name>
<TotalMessages>8</TotalMessages>
<Selected>false</Selected>
</Folder>
</Folders>
</FolderListResponse>
user_search

User Search Request Fields


Field Description Default Data Type Restrictions Required?

username Partial username to search on - String Minimum 3 characters Yes

User Search Response Fields


Field Description

Users Container for one or more User elements. There will be a maximum of 15 results returned

Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<UserSearchResponse>
<Users>
<User id="27">Dan</User>
<User id="163315">Dan Auger</User>
<User id="165814">Dan Board</User>
<User id="278460">Dan Carson</User>
<User id="15229">Dan Chu</User>
<User id="312841">dan druff</User>
<User id="126658">Dan Ellsworth</User>
<User id="287680">dan fernandes</User>
<User id="208268">Dan from Montreal</User>
<User id="127952">Dan Humniski</User>
<User id="294411">dan lal</User>
<User id="18302">Dan M.</User>
<User id="126819">dan magee</User>
<User id="243169">Dan R</User>
<User id="119984">Dan Samuel</User>
</Users>
</UserSearchResponse>
Appendix

Folder Element
This element has an id attribute representing the unique identifier for the folder

Field Description

Name Name of folder

TotalMessages The total number of messages in the folder

true or false if this folder is the current folder that messages are being selected
Selected
from

Pagination Element
Field Description

CurrentPage Current page of results

TotalPages The total number of pages based on the Total and PerPage

PerPage Items to return per page

Total The total number of results

The number of results returned. This should always equal the PerPage unless it is the
Returned
last page of results that may not contain exactly PerPage

Message Element
This element has an id attribute representing the unique identifier for the message

Field Description

Subject Subject of message

Preview A truncated preview of the body

Body Complete message body

Date MessageDate element

From Container for a single User element

To Container for 1 or more User elements

Cc Container for 0 or more User elements

Bcc Container for 0 or more User elements

Status of message:
0. Unread
Status 1. Read
2. Replied to
3. Forwarded
User Element
This element has an id attribute representing the unique identifier for the user

<User id="27">Dan</User>
Revision History

Date Changes

August 17, 2010 First publication of API documentation

Anda mungkin juga menyukai