Comments API
Comments allow users to leave feedback or record decisions about a run.
List Comments for a Run
GET /runs/:id/comments
Parameter | Description |
---|---|
id | The ID of the run. |
Sample Request
$ curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/runs/run-KTuq99JSzgmDSvYj/comments
Sample Response
{
"data": [
{
"id": "wsc-JdFX3u8o114F4CWf",
"type": "comments",
"attributes": {
"body": "A comment body"
},
"relationships": {
"run-event": {
"data": {
"id": "re-fo1YXZ8W5bp5GBKM",
"type": "run-events"
},
"links": {
"related": "/api/v2/run-events/re-fo1YXZ8W5bp5GBKM"
}
}
},
"links": {
"self": "/api/v2/comments/wsc-JdFX3u8o114F4CWf"
}
},
{
"id": "wsc-QdhSPFTNoCTpfafp",
"type": "comments",
"attributes": {
"body": "Another comment body"
},
"relationships": {
"run-event": {
"data": {
"id": "re-fo1YXZ8W5bp5GBKM",
"type": "run-events"
},
"links": {
"related": "/api/v2/run-events/re-fo1YXZ8W5bp5GBKM"
}
}
},
"links": {
"self": "/api/v2/comments/wsc-QdhSPFTNoCTpfafp"
}
}
]
}
Show a Comment
GET /comments/:id
Parameter | Description |
---|---|
id | The ID of the comment. |
Sample Request
$ curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/comments/wsc-gTFq83JSzjmAvYj
Sample Response
{
"data": {
"id": "wsc-gTFq83JSzjmAvYj",
"type": "comments",
"attributes": {
"body": "Another comment"
},
"relationships": {
"run-event": {
"data": {
"id": "re-8RB5ZaFrDanG2hGY",
"type": "run-events"
},
"links": {
"related": "/api/v2/run-events/re-8RB5ZaFrDanG2hGY"
}
}
},
"links": {
"self": "/api/v2/comments/wsc-gTFq83JSzjmAvYj"
}
}
}
Create Comment
POST /runs/:id/comments
Parameter | Description |
---|---|
id | The ID of the run. |
Request Body
This POST endpoint requires a JSON object with the following properties as the request payload.
Key Path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "comments" . | |
data.attributes.body | string | The body of the comment. |
Sample Payload
{
"data": {
"attributes": {
"body": "A comment about the run",
},
"type": "comments"
}
}
Sample Request
$ curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request POST \
--data @payload.json \
https://app.terraform.io/api/v2/runs/run-KTuq99JSzgmDSvYj/comments
Sample Response
{
"data": {
"id": "wsc-oRiShushpgLU4JD2",
"type": "comments",
"attributes": {
"body": "A comment about the run"
},
"relationships": {
"run-event": {
"data": {
"id": "re-E3xsBX11F1fbm2zV",
"type": "run-events"
},
"links": {
"related": "/api/v2/run-events/re-E3xsBX11F1fbm2zV"
}
}
},
"links": {
"self": "/api/v2/comments/wsc-oRiShushpgLU4JD2"
}
}
}