Api::V1::CommentsController API

should update an existing comment

PUT /api/v1/comments/:id

Parameters

Name Description
body comment body
attachments_attributes comment attachment attributes

Request

Headers

Accept: application/json
X-Api-Token: tE1Yjcsy3W824wR7Tm3ugwVFxChZfsgSjQ
X-Api-Email: user-208@example.com

Route

PUT /api/v1/comments/85

Body

{"body":"Updated","attachments_attributes":{"0":{"comment_id":85,"school_id":104,"kind":"image","name":"squirrel.png","url":"https://cdn.filestackcontent.com/7ikhsaLeTDCPJaiKY4k0"}}}

cURL

curl "http://localhost:3000/api/v1/comments/85" -d '{"body":"Updated","attachments_attributes":{"0":{"comment_id":85,"school_id":104,"kind":"image","name":"squirrel.png","url":"https://cdn.filestackcontent.com/7ikhsaLeTDCPJaiKY4k0"}}}' -X PUT \
	-H "Accept: application/json" \
	-H "X-Api-Token: tE1Yjcsy3W824wR7Tm3ugwVFxChZfsgSjQ" \
	-H "X-Api-Email: user-208@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

Content-Type: application/json; charset=utf-8
Content-Length: 1033

Status

202 Accepted

Body

{
  "created_at": "2019-10-31T22:00:05Z",
  "id": 85,
  "workflow_state": "approved",
  "ancestry": null,
  "body": "Updated",
  "permalink_url": "http://school.worksonmy.computer/courses/67/lectures/16/comments/85",
  "full_url": "http://school.worksonmy.computer/courses/67/lectures/16#comment_85",
  "commentable_id": 16,
  "commentable_type": "Attachment",
  "parent_id": null,
  "depth": 0,
  "user_id": 210,
  "meta": {
    "class": "comment",
    "url": null,
    "name": "85",
    "description": "",
    "image_url": null
  },
  "gravatar_url": "https://s.gravatar.com/avatar/6bb9e4112bdfd9491d24b80afbf6dc0c?d=mm&s=70",
  "creator_name": "User Name",
  "creator_role": "owner",
  "attachments": [
    {
      "created_at": "2019-10-31T22:00:05Z",
      "id": 2,
      "comment_id": 85,
      "url": "https://cdn.filestackcontent.com/7ikhsaLeTDCPJaiKY4k0",
      "kind": "image",
      "name": "squirrel.png",
      "meta": {
        "class": "commentattachment",
        "url": null,
        "name": "squirrel.png",
        "description": "",
        "image_url": null
      },
      "thumbnail_url": "https://process.fs.teachablecdn.com/ADNupMnWyR7kCWRvm76Laz/resize=width:200,height:200/https://cdn.filestackcontent.com/7ikhsaLeTDCPJaiKY4k0"
    }
  ]
}