Skip to content
Owen Swerkstrom edited this page Jul 9, 2015 · 6 revisions

A motion service is meant to either teach the consumer something new about a message, or do something to a message. For example, a virus scanner service may be used to learn if the message contains a virus or not. A quarantine service may store the message in a quarantine (and ask the consumer to delete it).

A motion service is defined by a manifest file that describes the service, including it's supported endpoints and the rights that it requires. This manifest must be accessible via HTTP for any software wishing to consume the service.

{
    "name": "Identify Language",
    "description": "Identify the languages used in the message body",
    "requires": [ "body" ],
    "modifies": [ ],
    "endpoint": "https://example.com/identify-language"
}

The service is invoked using an HTTP POST request with a JSON document describing the message as a payload. The response is a modified version of the JSON document.

C: POST /identify-language HTTP/1.1
C: Content-Type: application/json
C:
C: {
C:     "sender": { "address": "[email protected]" },
C:     "recipients": [
C:         { "address": "[email protected]" }
C:     },
C:     "header": [
C:         "Subject: This is a test"
C:     ],
C:     "body": [
C:         "This is a test message.",
C:         "It is being used as an example.",
C:         "",
C:         "--bob"
C:     ]
C: }
S: HTTP/1.1 200 Ok
S: Content-Type: application/json
S:
S: {
S:     "conclusions": {
S:         "languages": [ "en" ]
S:     }
S: }

The service can omit portions of the document that are not changed. In this example the service simply adds the information that it was able to learn about the message.

Clone this wiki locally