Web API Docs Update contribution

Navigate

Request

PATCH /api/projects/:project_id/contributions/:contribution_id/

URL parameters

Parameter Type Description
project_id Integer Unique identifier for the project.
contribution_id Integer Unique identifier for the contribution.

Request headers

Header Required value
Content-Type application/json

PATCH body example

The body contains are partial contribution with only the fields you want to update. Fields that are not present will remain untouched.

{
  "properties": {
      "address": "20 Prince of Wales Road, London NW5 3LG"
  }
}

Response

The response contains the GeoJSON encoded contribution.

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
200 The contribution has been updated successfully.
400 The request data is not valid.
403 The user authenticated with the request is not allowed to update the contribution (You have to be either creator of the contribution or a moderator of the project).
404 The project or contribution 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.