Causes

Fetch all causes


Return all the causes
GET /causes
page Page number of causes to return. Returns empty array if the page has no causes. If page parameter isn't present, returns the first page Optional
size Number of causes to return in a page. If size parameter isn't present, returns the page with 25 causes Optional
Response Body
[
    {
        "_id": "52244147cce8b40b97000001",
        "name": "Too Expensive",
        "type": "lost",
        "leads": [
            {
                "_id": "527375b9cce8b41b0900000a",
                "name": "Alex Iskold",
                "size": null
            }
        ]
    },
    {
        "_id": "52724e25cce8b44bef00003b",
        "name": "Product Quality",
        "type": "won",
        "leads": [
            {
                "_id": "527375b9cce8b41b09000001",
                "name": "Aaron Skloff",
                "size": null
            }
        ]
    }
]

Show a cause


Show details of an individual cause
GET /causes/:cause_id
cause_id Unique identifier of the cause Required
Response Body
{
    "_id": "52244147cce8b40b97000001",
    "name": "Too Expensive",
    "type": "lost",
    "leads": [
        {
            "_id": "527375b9cce8b41b0900000a",
            "name": "Alex Iskold",
            "size": null
        }
    ]
}

Create a cause


Create a new cause
POST /causes
name Name of the cause Required
type Type of the cause. Must be either "won" or "lost". Required
Response Body
{
    "_id": "527c8dcfcce8b4c547000001",
    "name": "Pricing",
    "type": "won"
}

Update a cause


Update the name of a cause
PUT /causes/:cause_id
cause_id Unique identifier of the cause Required
name Name of the cause Required
Response Body
{
    "_id": "527c8dcfcce8b4c547000001",
    "name": "Pricing",
    "type": "won"
}

Delete a cause


Delete a cause
DELETE /causes/:cause_id
cause_id Unique identifier of the cause Required
Response Body
{}