Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated 'mail' and 'info' services #15

Open
wants to merge 4 commits into
base: jkerihuel/mapistore-python
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 200 additions & 32 deletions api/mapistore_http/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ Backend info
Content-Type: application/json

{
"name": "My MAPISTORE Backend",
"version": 3,
"capabilities": {
"soft_delete": true,
"...": "...",
},
},
"name": "My MAPISTORE Backend",
"version": 3,
"capabilities": {
"soft_delete": true,
"...": "...",
},
"contexts": [
{
"url": "/calendars/",
"roles": ["calendar"],
"name": "Personal Calendar",
"main_folder": true
}
]
}

:reqheader Authorization: auth token
:reqheader Accept: the response content type depends on
Expand Down Expand Up @@ -402,8 +410,168 @@ Folders


Email
------
TBD
-----

TODO
- Define sending e-mail
- Do we need special handling for Recipients?
- Move/Copy message defintion?


.. http:post:: /mail/

:synopsis: Creates a new mail message and returns its ID.
``parent_id`` and ``PidTagSubject``` are required.
Other message attributes are optional.

**Example request**:

.. sourcecode:: http

POST /mail/ HTTP/1.1
Host: example.com
Accept: application/json

{
"parent_id": "c7e77cc9999908ec54ae32f1faf17e0e",
"PidTagSubject": "New mail message",
"PidTagBody": "Message text body",
"PidTagBodyHtml": "<html>....</html>"
}

:<json string parent_id: Parent Folder Identifier
:<json string PidTagSubject: Message subject line
:<json string PidTagBody: Message body - text format
:<json string PidTagBodyHtml: HTML formatted body for mail message


**Example response**:

.. sourcecode:: http

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
"id": "68b329da9893e34099c7d8ad5cb9c940"
}

:>json string id: Message Identifier of the message created
:reqheader Authorization: auth token
:statuscode 200: Ok
:statuscode 422: The request was well-formed but was unable
to be followed due to semantic errors


.. http:get:: /mail/(id)/

:synopsis: Retrieve all the properties of an email message
identified by `id`

**Example request**:

.. sourcecode:: http

GET /mail/15924213158245d0ad631c6a41a0e7c3/ HTTP/1.1
Host: example.com
Accept: application/json

**Example response**:

.. sourcecode:: http

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
"id": "15924213158245d0ad631c6a41a0e7c3",
"parent_id": "cea793f236334942bdae2c1e6c83607d",
"PidTagSubject": "New mail message",
"PidTagBody": "Sample body",
"PidTagBodyHtml": "<html>...</html>"
},

:reqheader Authorization: auth token
:reqheader Accept: the response content depends on on
:mailheader:`Accept` header
:resheader Content-Type: this depends on :mailheader:`Accept`
header of the request
:statuscode 200: Ok
:statuscode 404: Item does not exist


.. http:put:: /mail/(id)/

:synopsis: Set properties on email message identified by `id`

**Example request**:

.. sourcecode:: http

PUT /mail/15924213158245d0ad631c6a41a0e7c3/ HTTP/1.1
Host: example.com
Accept: application/json

{
"PidTagBody": "Sample body v2"
}

**Example response**:

.. sourcecode:: http

HTTP/1.1 201 No Content

:reqheader Authorization: auth token
:statuscode 201: The update was successfully applied
:statuscode 400: Bad request


.. http:head:: /mail/(id)/

:synopsis: Check if the email message identified by `id` exists

**Example request**:

.. sourcecode:: http

HEAD /calendars/15924213158245d0ad631c6a41a0e7c3/ HTTP/1.1
Host: example.com

**Example response**:

.. sourcecode:: http

HTTP/1.1 200 OK

:reqheader Authorization: auth token
:statuscode 200: Ok
:statuscode 404: Item does not exist


.. http:delete:: /mail/(id)/

:synopsis: Delete the email message identified by `id`

**Example request**:

.. sourcecode:: http

DELETE /mail/15924213158245d0ad631c6a41a0e7c3 HTTP/1.1
Host: example.com

**Example response**:

.. sourcecode:: http

HTTP/1.1 204 No content

:reqheader Authorization: auth token
:statuscode 204: Ok
:statuscode 404: Item does not exist


Calendar
--------
Expand All @@ -423,7 +591,7 @@ Calendar
{
"parent_id": "cea793f236334942bdae2c1e6c83607d",
"PidTagSubject": "My sample appointment",
"PidTagBody": "Sample body"
"PidTagBody": "Sample body"
}

**Example response**:
Expand Down Expand Up @@ -466,9 +634,9 @@ Calendar

{
"id": "15924213158245d0ad631c6a41a0e7c3",
"parent_id": "cea793f236334942bdae2c1e6c83607d",
"PidTagSubject": "My sample appointment",
"PidTagBody": "Sample body"
"parent_id": "cea793f236334942bdae2c1e6c83607d",
"PidTagSubject": "My sample appointment",
"PidTagBody": "Sample body"
},

:reqheader Authorization: auth token
Expand Down Expand Up @@ -584,9 +752,9 @@ Tasks
"id": "b1f2726d32b44551b99f4a6adb61e112"
}

:>json string id: Message identifier of the task item created
:reqheader Authorization: auth token
:statuscode 200: Ok
:>json string id: Message identifier of the task item created
:reqheader Authorization: auth token
:statuscode 200: Ok


.. http:get:: /tasks/(id)/
Expand All @@ -612,9 +780,9 @@ Tasks

{
"id": "b1f2726d32b44551b99f4a6adb61e112",
"parent_id": "95fc55f35da743bc9450ae694f38def0",
"PidTagSubject": "My sample task",
"PidTagBody": "Sample body"
"parent_id": "95fc55f35da743bc9450ae694f38def0",
"PidTagSubject": "My sample task",
"PidTagBody": "Sample body"
},

:reqheader Authorization: auth token
Expand Down Expand Up @@ -730,9 +898,9 @@ Contacts
"id": "d220314b8a374d2bbd7f43bf0819b5a0"
}

:>json string id: Message identifier of the contact item created
:reqheader Authorization: auth token
:statuscode 200: Ok
:>json string id: Message identifier of the contact item created
:reqheader Authorization: auth token
:statuscode 200: Ok


.. http:get:: /contacts/(id)/
Expand All @@ -758,9 +926,9 @@ Contacts

{
"id": "d220314b8a374d2bbd7f43bf0819b5a0",
"parent_id": "9175fe8d54da416a9cb1a946c50b7467",
"PidTagSubject": "My sample contact",
"PidTagBody": "Sample body"
"parent_id": "9175fe8d54da416a9cb1a946c50b7467",
"PidTagSubject": "My sample contact",
"PidTagBody": "Sample body"
},

:reqheader Authorization: auth token
Expand Down Expand Up @@ -860,7 +1028,7 @@ Notes
{
"parent_id": "765dc8566f9e4baf94ee36e1b2763d50",
"PidTagSubject": "My sample note",
"PidTagBody": "Sample body"
"PidTagBody": "Sample body"
}

**Example response**:
Expand All @@ -875,9 +1043,9 @@ Notes
"id": "f07d68499c974a5bbffed5cc3ddcc31e"
}

:>json string id: Message identifier of the note item created
:reqheader Authorization: auth token
:statuscode 200: Ok
:>json string id: Message identifier of the note item created
:reqheader Authorization: auth token
:statuscode 200: Ok


.. http:get:: /notes/(id)/
Expand All @@ -903,9 +1071,9 @@ Notes

{
"id": "f07d68499c974a5bbffed5cc3ddcc31e",
"parent_id": "765dc8566f9e4baf94ee36e1b2763d50",
"PidTagSubject": "My sample note",
"PidTagBody": "Sample body"
"parent_id": "765dc8566f9e4baf94ee36e1b2763d50",
"PidTagSubject": "My sample note",
"PidTagBody": "Sample body"
},

:reqheader Authorization: auth token
Expand Down