Skip to content

Comments

The comment object

{
    "id": 1534,
    "created": "2022-11-03T06:03:04.590058Z",
    "modified": "2022-11-03T06:03:04.590632Z",
    "author": {
        "id": 202,
        "first_name": "Josh",
        "last_name": "Sharp",
        // shown here if user is a team member
        "email": null,
        // denotes whether the user is a team member
        "staff": false
    },
    // the ID of the comment object being replied to, if any
    "in_reply_to": null,
    // raw markdown
    "content": "Making a comment",
    // parsed into html
    "parsed_content": "<p>Making a comment</p>"
}

Get all comments for a task

Pass in the ID of the task in the URL.

GET https://changemap.co/api/1/map/tasks/:id/comments/

Request

curl "https://changemap.co/api/1/map/1/tasks/" \
  -H "Authorization: Token [your_token]"
import requests

task = 1
url = f"https://changemap.co/api/1/map/tasks/{task}/comments/"
requests.get(url,
    headers={'Authorization':'Token [your_token]'})

Response

Returns a paged list of comments.

{
    "count": 5,
    "next": null,
    "previous": null,
    "results": [
        { 
            // json comment object
        }
    ]
}

Get a specific comment

Pass in the ID of the comment in the URL.

GET https://changemap.co/api/1/map/comments/:id/

Request

curl "https://changemap.co/api/1/map/comments/1/" \
  -H "Authorization: Token [your_token]"
import requests

pk = 1
url = f"https://changemap.co/api/1/map/comments/{pk}/"
requests.get(url,
    headers={'Authorization':'Token [your_token]'})

Response

Returns a JSON comment object, or a HTTP 404 if it isn't found.

{
    "id": 1534,
    // snip...
}

Create a new comment

The comment's author will be the name you gave this API token.

POST https://changemap.co/api/1/map/comments/create/

Parameters

Send a JSON object with the following fields.

Name Required Value
parent Required Integer ID of parent task
content Required String markdown body of the comment
in_reply_to Integer ID of the comment this is in reply to

Request

curl "https://changemap.co/api/1/map/comments/create/" \
  -X "POST" -d "{parent: 1, content: 'Automated update: this task is now high priority' }" \
  -H "Authorization: Token [your_token]" \
  -H "Content-type: application/json"
import requests
import json

url = "https://changemap.co/api/1/map/comments/create/"

obj = json.dumps({"parent": 1,
    "content": "Automated update: this task is now high priority"})

requests.post(url, data=obj,
    headers={'Authorization':'Token [your_token]',
    'Content-type':'application/json'})

Response

A successful response returns a HTTP 201 Created and the new comment object as JSON. Errors with your data will return a HTTP 400 including a list of validation errors.

{
    "id": 79,
    "changemap_url": "https://changemap.co/hellocode/changemap/79-blocked/",
    // snip...
}

Delete a comment

Use the DELETE method and pass the comment ID to specify which comment.

DELETE https://changemap.co/api/1/map/comments/:id/

Request

curl "https://changemap.co/api/1/map/comments/1/" \
  -X "DELETE" -H "Authorization: Token [your_token]"
import requests

pk = 1
url = f"https://changemap.co/api/1/map/comments/{pk}/"
requests.delete(url,
    headers={'Authorization':'Token [your_token]'})

Response

Returns an empty HTTP 204 if successful, or HTTP 404 if not found.