Web API Docs Add contribution

Navigate

Request

POST /api/projects/:project_id/contributions/

URL Parameters

Parameter Type Description
project_id Integer A unique identifier for the project.

Request headers

Header Required value
Content-Type application/json

POST body example

The POST body must contain a GeoJSON encoded description of the contribution and its location.

{
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            -0.144415497779846,
            51.54671869005856
        ]
    },
    "properties": {
        "child_friedly": false,
        "name": "The Grafton",
        "address": "20 Prince of Wales Rd, London NW5 3LG"
    },
    "meta": {
        "category": 40
    }
}

Response

Example response

{
    "id": 2966,
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            -0.144415497779846,
            51.54671869005856
        ]
    },
    "properties": {
        "child_friendly": false,
        "name": "The Grafton",
        "address": "20 Prince of Wales Rd, London NW5 3LG",
        "expires_at": "2030-01-12T11:12:38.690Z"
    },
    "display_field": {
        "key": "name",
        "value": "The Grafton"
    },
    "expiry_field": "2030-01-12T11:12:38.690Z",
    "location": {
        "id": 2964,
        "name": null,
        "description": null,
        "created_at": "2014-09-19T15:51:32.790Z"
    },
    "meta": {
        "creator": {
            "id": 2,
            "display_name": "Oliver"
        },
        "isowner": true,
        "updator": null,
        "status": "active",
        "created_at": "2014-09-19T15:51:32.804Z",
        "updated_at": "2014-09-21T15:51:32.804Z",
        "version": 1,
        "category": {
            "id": 40,
            "name": "Pubs",
            "description": "",
            "status": "active",
            "fields": [
                {
                    "id": 117,
                    "name": "Name",
                    "key": "name",
                    "fieldtype": "TextField",
                    "description": "",
                    "status": "active",
                    "required": true
                },
                {
                    "id": 118,
                    "name": "Address",
                    "key": "address",
                    "fieldtype": "TextField",
                    "description": "",
                    "status": "active",
                    "required": false
                },
                {
                    "id": 119,
                    "name": "Average spend",
                    "key": "average_spend",
                    "fieldtype": "NumberField",
                    "description": "How much would a person usually spend?",
                    "status": "active",
                    "required": false
                }
            ],
            "colour": "#0033ff",
            "created_at": "2014-09-17T00:00:00Z"
        }
    },
    "comments": [],
    "review_comments": [],
    "media": []
}

Response codes

Code Reason
201 The contribution has been stored successfully.
400 The request data is not valid.
403 The user authenticated with the request is not allowed to contribute to the project.
404 The project was not found. For security reasons we do not leak information about private projects, hence we don’t confirm existence private projects to unauthorised users.