Mandate 2 Protocol

Example Use Cases

Simple Request

In this example, we use Mandate 2 to send a simple request for cat pictures.

GET /cats HTTP/1.1
Host: example.com
Accept: application/json

And the server responds with:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "cat_pics": [
        "https://example.com/cat_pics/1.jpg",
        "https://example.com/cat_pics/2.jpg"
    ]
}

View simple responses

Crazy Request

We use Mandate 2 to make a complex request for cat pictures with specific requirements.

GET /cats?color=blue&breed=Siamese HTTP/1.1
Host: example.com
Accept: application/json

And the server responds with:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "blue_breeds": [
        "https://example.com/blue_breeds/1.jpg",
        "https://example.com/blue_breeds/2.jpg"
    ]
}

View crazy requests

Invalid Request

What happens when we make a request that doesn't follow the rules?

GET /cats?color=red HTTP/1.1
Host: example.com
Accept: application/json

And the server responds with:

HTTP/1.1 400 Bad Request
Content-Type: text/plain
Bad color: red

View invalid requests

Back to Main