Folders & rules

Creating, renaming, moving and ordering folders, and mail rules (filters run on the server).

MethodPathSummary
GET/api/foldersList a mailbox's folders
POST/api/foldersCreate a folder
PATCH/api/foldersRename or move a folder
DELETE/api/foldersDelete a folder
PUT/api/folders/orderSave the folder order
GET/api/rulesList mail rules
PUT/api/rulesSave mail rules

#List a mailbox's folders

GET/api/folders
Address
https://<your-org>.brambleit.cloud/mail/api/folders
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Query parameters

NameTypeDescription
mbanyThe mailbox.

Response 200

FieldTypeDescription
foldersarray of any
orderany
canManageboolean
Example response
JSON
{
  "folders": [],
  "order": null,
  "canManage": false
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/folders', {
  method: 'GET',
  credentials: 'include',
});
const data = await res.json();

#Create a folder

POST/api/folders

A new folder (parent '' = top level).

Address
https://<your-org>.brambleit.cloud/mail/api/folders
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Request body JSON

NameTypeDescription
mbanyThe mailbox.
parentanyThe parent folder's path ('' for the top level).
namestringThe new folder's name.

Response 200

FieldTypeDescription
okboolean
pathstring
Example response
JSON
{
  "ok": true,
  "path": "string"
}

Errors

StatusMessage
404That folder has gone
409There is already a folder with that name there
400The mail server didn't create it: …

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/folders', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"mb":"…","parent":"…","name":"Example name"}),
});
const data = await res.json();

#Rename or move a folder

PATCH/api/folders

Rename and/or move.

Address
https://<your-org>.brambleit.cloud/mail/api/folders
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Request body JSON

NameTypeDescription
mbany
pathstring
parentany
namestring

Response 200

FieldTypeDescription
okboolean
pathstring
Example response
JSON
{
  "ok": true,
  "path": "string"
}

Errors

StatusMessage
404That folder has gone
400Inbox, Drafts, Sent, Junk and Trash can't be renamed or moved
404The folder to move it into has gone
400A folder can't go inside itself
409There is already a folder with that name there
400The mail server didn't rename it: …

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/folders', {
  method: 'PATCH',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"mb":"…","path":"string","parent":"…","name":"Example name"}),
});
const data = await res.json();

#Delete a folder

DELETE/api/folders

Its messages go to Trash first.

Address
https://<your-org>.brambleit.cloud/mail/api/folders
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Request body JSON

NameTypeDescription
mbany
pathstring

Response 200

FieldTypeDescription
okboolean
movedToTrashany
Example response
JSON
{
  "ok": true,
  "movedToTrash": null
}

Errors

StatusMessage
404That folder has gone
400Inbox, Drafts, Sent, Junk and Trash can't be deleted
400Move or delete the folders inside it first
400The mail server didn't delete it: …

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/folders', {
  method: 'DELETE',
  credentials: 'include',
});
const data = await res.json();

#Save the folder order

PUT/api/folders/order

How you arranged them.

Address
https://<your-org>.brambleit.cloud/mail/api/folders/order
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Request body JSON

NameTypeDescription
mbany
orderarray of any

Response 200

FieldTypeDescription
okboolean
Example response
JSON
{
  "ok": true
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/folders/order', {
  method: 'PUT',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"mb":"…","order":[]}),
});
const data = await res.json();

#List mail rules

GET/api/rules
Address
https://<your-org>.brambleit.cloud/mail/api/rules
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Query parameters

NameTypeDescription
mbany

Response 200

Errors

StatusMessage
422These rules were written in a way Bramble can't read. Ask Bramble IT to look at them.

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/rules', {
  method: 'GET',
  credentials: 'include',
});
const data = await res.json();

#Save mail rules

PUT/api/rules

Replaces the whole list, in order.

Address
https://<your-org>.brambleit.cloud/mail/api/rules
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Mail.

Request body JSON

NameTypeDescription
mbany
rulesarray of any

Response 200

FieldTypeDescription
okboolean
Example response
JSON
{
  "ok": true
}

Errors

StatusMessage
400Send the list of rules

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/mail/api/rules', {
  method: 'PUT',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"mb":"…","rules":[]}),
});
const data = await res.json();