forked from wmorgan/heliotrope
-
Notifications
You must be signed in to change notification settings - Fork 1
Message api
rakoo edited this page Jun 9, 2012
·
5 revisions
Get all the metadata of the file, plus the parts. If they are text/plain
, they are returned along; if they are not, there is only the metadata.
GET /message/XXX.json
where XXX
is the message id
{
"subject": "",
"date": 1297966591,
"from": "Sebastian Lipp <[email protected]>",
"to": [
"sup-talk <[email protected]>"
],
"cc": [],
"has_attachment": true,
"loc": 61239033,
"state": [
"attachment"
],
"labels": [
"sup",
"attachment"
],
"thread_id": 2713,
"snippet": "Excerpts from Peter Lewis's message of Do Feb 17 02:02:34 +0100 2011: > So here's the newbie questio",
"message_id": 2712,
"bcc": [],
"refs": [
"[email protected]"
],
"parts": [
{
"type": "text/plain; charset=utf-8",
"filename": null,
"cid": "[email protected]",
"content": "Excerpts from Peter Lewis's message of Do Feb 17 02:02:34 +0100 2011:\n> So here's the newbie question: I had a look through the manual etc. and I \n> didn't seem to be able to find out any way of reversing the order in which the \n> messages are displayed in the list. It only seems to be able to have the most \n> recent at the top, etc., which I've been trained over the years to not be used \n> to. Is there a way to switch the order?\n\nYou may patch sup with the files attached.\n\nBut they are from Sept 2009, so they most likely will not succeed\ncompletely. You might have to adjust some lines of code manually.\n\n-- \nbasti\n \nIf we have never called ourselves insurrectionists, it is not because we\ndo not wish for insurrection, but because our own temperament\npredisposes us to an anarchism without adjectives. The important thing\nis to fight for freedom and against hierarchy; we imagine that this will\ndemand different approaches in different situations, and that these\napproaches may need one another to succeed. We are anarcho-syndicalists\non the shop floor, green anarchists in the woods, social anarchists in\nour communities, individualists when you catch us alone,\nanarcho-communists when there's something to share, insurrectionists\nwhen we strike a blow.\n -- say you want an insurrection\n\t-- <http://www.crimethinc.com/texts/rollingthunder/insurrection.php>",
"here": true
},
{
"type": "text/plain; charset=us-ascii",
"filename": null,
"cid": "[email protected]",
"content": "_______________________________________________\nsup-talk mailing list\[email protected]\nhttp://rubyforge.org/mailman/listinfo/sup-talk",
"here": true
},
{
"type": "application/octet-stream; charset=utf-8; name=0001-allow-thread-index-view-to-sort-oldest-first.patch",
"filename": "0001-allow-thread-index-view-to-sort-oldest-first.patch",
"cid": "[email protected]",
"size": 7502,
"here": false
},
{
"type": "application/octet-stream; charset=utf-8; name=0002-change-the-default-sort-for-inbox-mode-to-be-oldest.patch",
"filename": "0002-Change-the-default-sort-for-inbox-mode-to-be-oldest.patch",
"cid": "[email protected]",
"size": 777,
"here": false
}
],
"reply_to": "",
"recipient_email": "[email protected]",
"list_post": "<mailto:[email protected]>",
"list_subscribe": "<http://rubyforge.org/mailman/listinfo/sup-talk>, <mailto:[email protected]?subject=subscribe>",
"list_unsubscribe": "<http://rubyforge.org/mailman/options/sup-talk>, <mailto:[email protected]?subject=unsubscribe>",
"email_message_id": "1297966539-sup-4248@fly",
"response": "ok"
}
Just like their thread
counterpart, messages can directly benefit from a little HTML formatting by requesting the following end point :
GET /message/XXX
where XXX is the message id.
GET /message/XXX/part/YYY
where :
- XXX is the message id
- YYY is the part id. It must exist in the message.
The response is the relevant part, decoded, as-is.
Get the message rawbody, as received by heliotrope and stored.
GET /message/XXX/raw
where XXX
is the message id
The rawbody
A message labels are changed on its thread level. You have to use the thread endpoint, described in this wiki's home page.
State, on the other hand, are message-specific.
POST /message/XXX/state.json
where XXX
is the message id.
Parameters :
-
state
: a JSON array of the new state. This is destructive : if you just want to add a state, you have to include the entries already there.
A lighter version than the first one.
{
"subject": "Re: [sup-talk] Hi and noob question.",
"date": 1297966591,
"from": "Sebastian Lipp <[email protected]>",
"to": [
"sup-talk <[email protected]>"
],
"cc": [],
"has_attachment": true,
"loc": 61239033,
"state": [
"attachment",
"starred" // note that I added the "starred" state
],
"labels": [
"sup",
"attachment",
"starred"
],
"thread_id": 2713,
"snippet": "Excerpts from Peter Lewis's message of Do Feb 17 02:02:34 +0100 2011: > So here's the newbie questio",
"message_id": 2712,
"response": "ok"
}