MailServiceImpl

This group contains the following resources:

/mail/folders

URI: /api/v1/mail/folders

GET

Get the folder list of the user that is using the application. The name of the folder has the names of the uplevel folder. So, if there is a folder named "Test" inside the folder named "Inbox", the name of the resource that represent the folder "Test" will be "Inbox - Test". The user must have given the application the grant READ_MAIL to use these operation.

Response Body

element: folderList
FolderList object with user's folders. Represents a list of folders.
Properties
Property Type Description
folders array of (folder) Folder list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folderList> <folders> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folders> <folders> <!--...--> </folders> <!--...more "folders" elements...--> </folderList>
Response Example (JSON)
{ "folders" : [ { "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersGet

POST

Create a new folder. The folder is created at the top level of folders. The user must have given the application the grant WRITE to use these operation.

Request Body

element: folder
Folder to create. The id, unreadMessages and totalMessages fields are dismissed.

Response Body

element: folder
Created folder. Represents a folder.
Properties
Property Type Description
id string Folder's identifier.
name string Folder's name.
unreadMessages long Number of unread messages.
totalMessages long Number of messages.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
POST http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folder> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folder>
Response Example (JSON)
{ "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersPost

/mail/messages

URI: /api/v1/mail/messages

GET

Get the messages of folder Inbox. The number of message to obtain can be limited via start and end parameters. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
start First element to return. query 0
end Last element to return (all elements to return if this field is greater than the total number of elements). query -1
q Search criteria. If no fields are specified the search is done in all the fields of the message (metadata + body). If you want a more advanced search, search can be restringed using the following fields:
  • to: Search by recipients.
  • from: Search by sender.
  • subject: Search by subject.
  • before: Search by date, beign earlier than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • after: Search by date, beign later than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • recurse: (yes | no) Search in subfolders or not.
For instance:
  • &q=Xavi search all messages that contains Xavi either in the body of the message or in its metadata.
  • &q=to:openapi subject:TFC search messages sent to openapi where its subject contains TFC.
query

Response Body

element: messageList
MessageList object with the messages of the Inbox folder. Represents a list of messages.
Properties
Property Type Description
messages array of (message) Message list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageList> <messages> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </messages> <messages> <!--...--> </messages> <!--...more "messages" elements...--> </messageList>
Response Example (JSON)
{ "messages" : [ { "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesGet

POST

Send a new mail message. The user must have given the application the grant SEND_MAIL to use these operation.

Request Body

element: message
Message object with the data of the messagen to send (recipients, subject, etc).

Response Body

element: message
Message object with the created message. Represents a mail message.
Properties
Property Type Description
id string Message's identifier.
subject string Message's subject.
snippet string First characters of the message.
date string Message's date.
color long Color mark of the message.
status long Message's status.
from string Message's sender.
to string Message's recipients.
cc string Message's copy recipients.
body string Message's body.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
POST http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <message> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </message>
Response Example (JSON)
{ "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersPost

/mail/folders/inbox

URI: /api/v1/mail/folders/inbox

GET

Get the data of the Inbox folder. The user must have given the application the grant READ_MAIL to use these operation.

Response Body

element: folder
Folder object with data of the Inbox folder. Represents a folder.
Properties
Property Type Description
id string Folder's identifier.
name string Folder's name.
unreadMessages long Number of unread messages.
totalMessages long Number of messages.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders/inbox
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folder> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folder>
Response Example (JSON)
{ "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersInboxGet

/mail/folders/{id}

URI: /api/v1/mail/folders/{id}

GET

Get info about the folder. The name of the folder has the names of the uplevel folder. So, if there is a folder named "Test" inside the folder named "Inbox", the name of the resource that represent the folder "Test" will be "Inbox - Test". The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Folder's identifier. path

Response Body

element: folder
Folder object with folder's data. Represents a folder.
Properties
Property Type Description
id string Folder's identifier.
name string Folder's name.
unreadMessages long Number of unread messages.
totalMessages long Number of messages.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders/602574
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folder> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folder>
Response Example (JSON)
{ "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersIdGet

/mail/messages/unread

URI: /api/v1/mail/messages/unread

GET

Get the unread messages of folder Inbox. The number of message to obtain can be limited via start and end parameters. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
start First element to return. query 0
end Last element to return (all elements to return if this field is greater than the total number of elements). query -1
q Search criteria. If no fields are specified the search is done in all the fields of the message (metadata + body). If you want a more advanced search, search can be restringed using the following fields:
  • to: Search by recipients.
  • from: Search by sender.
  • subject: Search by subject.
  • before: Search by date, beign earlier than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • after: Search by date, beign later than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • recurse: (yes | no) Search in subfolders or not.
For instance:
  • &q=Xavi search all messages that contains Xavi either in the body of the message or in its metadata.
  • &q=to:openapi subject:TFC search messages sent to openapi where its subject contains TFC.
query

Response Body

element: messageList
MessageList object with the unread messages of the Inbox folder. Represents a list of messages.
Properties
Property Type Description
messages array of (message) Message list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/unread
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageList> <messages> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </messages> <messages> <!--...--> </messages> <!--...more "messages" elements...--> </messageList>
Response Example (JSON)
{ "messages" : [ { "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesUnreadGet

/mail/messages/{id}

URI: /api/v1/mail/messages/{id}

GET

Get message's metadata. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Message identifier. path

Response Body

element: message
Message object with the message. Represents a mail message.
Properties
Property Type Description
id string Message's identifier.
subject string Message's subject.
snippet string First characters of the message.
date string Message's date.
color long Color mark of the message.
status long Message's status.
from string Message's sender.
to string Message's recipients.
cc string Message's copy recipients.
body string Message's body.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/398069376
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <message> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </message>
Response Example (JSON)
{ "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesIdGet

/mail/folders/{id}/messages

URI: /api/v1/mail/folders/{id}/messages

GET

Get the messages of folder id. The number of message to obtain can be limited via start and end parameters. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Folder's identifier. path
start First element to return. query 0
end Last element to return (all elements to return if this field is greater than the total number of elements). query -1
q Search criteria. If no fields are specified the search is done in all the fields of the message (metadata + body). If you want a more advanced search, search can be restringed using the following fields:
  • to: Search by recipients.
  • from: Search by sender.
  • subject: Search by subject.
  • before: Search by date, beign earlier than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • after: Search by date, beign later than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • recurse: (yes | no) Search in subfolders or not.
For instance:
  • &q=Xavi search all messages that contains Xavi either in the body of the message or in its metadata.
  • &q=to:openapi subject:TFC search messages sent to openapi where its subject contains TFC.
query

Response Body

element: messageList
MessageList object with the messages of the given folder. Represents a list of messages.
Properties
Property Type Description
messages array of (message) Message list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders/602574/messages
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageList> <messages> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </messages> <messages> <!--...--> </messages> <!--...more "messages" elements...--> </messageList>
Response Example (JSON)
{ "messages" : [ { "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersIdMessagesGet

/mail/messages/{id}/body

URI: /api/v1/mail/messages/{id}/body

GET

Get the body of the message with id as identifier. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Message identifier. path

Response Body

element: messageBody
MessageBody object with the body of the message. Represents the body of a mail message.
Properties
Property Type Description
id string Message's identifier
body string Message's body.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/398069376/body
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageBody> <id>398069376</id> <body>Lorem ipsum ...</body> </messageBody>
Response Example (JSON)
{ "id" : "398069376", "body" : "Lorem ipsum ..." }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesIdBodyGet

/mail/messages/{id}/history

URI: /api/v1/mail/messages/{id}/history

GET

Get message's historic actions. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Message identifier. path

Response Body

element: messageHistory
MessageHistory object with message's historic actions. Represents the historic actions of a mail message.
Properties
Property Type Description
id string Message's identifier.
details array of (messageHistoryDetail) Action list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/398069376/history
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageHistory> <id>398069376</id> <details> <action>...</action> <date>...</date> <name>...</name> <time>...</time> </details> <details> <!--...--> </details> <!--...more "details" elements...--> </messageHistory>
Response Example (JSON)
{ "id" : "398069376", "details" : [ { "action" : "...", "date" : "...", "name" : "...", "time" : "..." }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesIdHistoryGet

/mail/folders/{id}/messages/unread

URI: /api/v1/mail/folders/{id}/messages/unread

GET

Get the unread messages of folder id. The number of message to obtain can be limited via start and end parameters. The user must have given the application the grant READ_MAIL to use these operation.

Parameters

Name Description Type Default Value
id Folder's identifier. path
start First element to return. query 0
end Last element to return (all elements to return if this field is greater than the total number of elements). query -1
q Search criteria. If no fields are specified the search is done in all the fields of the message (metadata + body). If you want a more advanced search, search can be restringed using the following fields:
  • to: Search by recipients.
  • from: Search by sender.
  • subject: Search by subject.
  • before: Search by date, beign earlier than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • after: Search by date, beign later than the date given. Date format is dd/MM/yyyy HH:mm:ss
  • recurse: (yes | no) Search in subfolders or not.
For instance:
  • &q=Xavi search all messages that contains Xavi either in the body of the message or in its metadata.
  • &q=to:openapi subject:TFC search messages sent to openapi where its subject contains TFC.
query

Response Body

element: messageList
MessageList object with the unread messages of the given folder. Represents a list of messages.
Properties
Property Type Description
messages array of (message) Message list.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
GET http://denver.uoc.es:8080/webapps/uocapi/v1/mail/folders/602574/messages/unread
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <messageList> <messages> <id>398069376</id> <subject>Re: Que hi ha alg&amp;#250;?</subject> <snippet /> <date>30.06.2012 01:57</date> <color>0</color> <status>0</status> <from>Francesc Santanach Delisau</from> <to>Francesc Santanach Delisau</to> <cc>Francesc Santanach Delisau</cc> <body>Lorem ipsum ...</body> </messages> <messages> <!--...--> </messages> <!--...more "messages" elements...--> </messageList>
Response Example (JSON)
{ "messages" : [ { "id" : "398069376", "subject" : "Re: Que hi ha algú?", "snippet" : "", "date" : "30.06.2012 01:57", "color" : 0, "status" : 0, "from" : "Francesc Santanach Delisau", "to" : "Francesc Santanach Delisau", "cc" : "Francesc Santanach Delisau", "body" : "Lorem ipsum ..." }, ... ] }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersIdMessagesUnreadGet

/mail/messages/{id}/move/{folder_id}

URI: /api/v1/mail/messages/{id}/move/{folder_id}

POST

Move the message to a folder. The user must have given the application the grant WRITE to use these operation.

Parameters

Name Description Type Default Value
id Message identifier. path
folder_id Folder identifier to move the message to. path

Response Body

element: folder
Folder where the message has been moved to (null if folder doesn't exist or the user doesn't have the grant to write onto the folder). Represents a folder.
Properties
Property Type Description
id string Folder's identifier.
name string Folder's name.
unreadMessages long Number of unread messages.
totalMessages long Number of messages.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
POST http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/398069376/move/602574
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folder> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folder>
Response Example (JSON)
{ "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailMessagesIdMoveIdPost

/mail/folders/{source_id}/messages/{id}/move/{destination_id}

URI: /api/v1/mail/folders/{source_id}/messages/{id}/move/{destination_id}

POST

Move the message to a folder. The user must have given the application the grant WRITE to use these operation.

Parameters

Name Description Type Default Value
source_id Folder identifier where the message is located. path
id Message identifier. path
destination_id Folder identifier to move the message to. path

Response Body

element: folder
Folder where the message has been moved to (null if folder doesn't exist or the user doesn't have the grant to write onto the folder). Represents a folder.
Properties
Property Type Description
id string Folder's identifier.
name string Folder's name.
unreadMessages long Number of unread messages.
totalMessages long Number of messages.

Status Codes - Errors

The HTTP call return a status code depending on the result of the operation. These codes are listed below
Code Description
200 Success Call
401 Not authorized. Maybe you have to authorize the user o the OAuth token has expired

Example

HTTP Call Example
POST http://denver.uoc.es:8080/webapps/uocapi/v1/mail/messages/398069376/move/602574
Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?> <folder> <id>602574</id> <name>Rebuts</name> <unreadMessages>2901</unreadMessages> <totalMessages>3283</totalMessages> </folder>
Response Example (JSON)
{ "id" : "602574", "name" : "Rebuts", "unreadMessages" : 2901, "totalMessages" : 3283 }

Links

iOS: https://github.com/UOC/openapidemos/tree/master/Exemple%20MailFoldersIdMessagesIdMoveIdPost