Comments ======== Comments are short text notes in a thread with a common context. Terminology ----------- :thread: a group of comments :context: the Sheep URI that the comments all refer to :comment: the text snippet, automatically logged against the user and the current date & time :key: a unique ID for the thread (to allow multiple threads to exist on the same context) $CONTEXT is shorthand for the URI that we are commenting about a full URI would look like `/api/v1/example/organisation/5fa523e080859e33dc285c7e/threads/` Start a thread -------------- Create a new thread with no comments, a unique `key` for the thread is optional. .. code-block:: http $ http POST https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/ "Authorization: Bearer $API_KEY" title="So I have a question..." HTTP/1.0 201 Created { "bucket": "example", "data": { "context": { "display_value": "JW Travel", "ref": "/example/organisation/5fa523e080859e33dc285c7e/" }, "key": "c3c0fecd38", "legacy_uid": null, "thread": { "comments": [] }, "title": "So I have a question..." }, ... "uri": "/example/comment/603e35982e77f9de9421d470/" } Start a new thread and provide the first comment ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: http $ http POST https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/ "Authorization: Bearer $API_KEY" title="So I have a question..." comment="Do you think these guys like us?" View all threads ---------------- .. code-block:: http $ http GET https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/"Authorization: Bearer $API_KEY" HTTP/1.0 200 OK { "comments": { "37d91faf3": { "comments": [], "title": "pricing query", "uri": "/example/comment/603e326a535341676d33bb4c/" }, "8e75026d34": { "comments": [ { "comment": "Do you think these guys like us?", "datetime": "2021-03-02T13:00:21.187000", "uid": "f7d95f2939", "user": "/sheepcrm/user/5cab33e1638e5512a16d4a1f/" } ], "title": "So I have a question...", "uri": "/example/comment/603e36e52e77f9de9421d473/" }, }, } Delete a thread --------------- .. code-block:: http $ http DELETE https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/thread/{key}/ "Authorization: Bearer $API_KEY" HTTP/1.0 200 OK { "deleted": true } View a specific thread ---------------------- .. code-block:: http $ http GET https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/thread/{key}/comment/ "Authorization: Bearer $API_KEY" HTTP/1.0 200 OK { "thread": [ { "comment": "Do you think these guys like us?", "datetime": "2023-04-14T15:55:31.454000", "uid": "bc28e4bdf", "user": "/sheepcrm/user/.../", "user_display": "Support User", "user_images": { ... } }, { "comment": "Yeah, probably!", "datetime": "2023-04-14T16:13:11.430000", "uid": "488d65d531", "user": "/sheepcrm/user/.../", "user_display": "Support User", "user_images": { ... } } ], "title": "So I have a question...", "tuid": "537b52d3b4", "uri": "/example/comment/603e36e52e77f9de9421d473/" } Comment on a thread ------------------- :comment: required: text comment :key: required: the thread key .. code-block:: http $ http POST https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/thread/{key}/comment/ "Authorization: Bearer $API_KEY" comment="Why wouldn't they like us?" HTTP/1.0 200 OK { "comments": { "comments": [ { "comment": "Do you think these guys like us?", "datetime": "2021-03-02T13:00:21.187000", "uid": "f7d95f2939", "user": "/sheepcrm/user/5cab33e1638e5512a16d4a1f/" }, { "comment": "Why wouldn't they like us?", "datetime": "2021-03-02T13:04:22.711633", "uid": "204f6a060d", "user": "/sheepcrm/user/5cab33e1638e5512a16d4a1f/" } ] } } Delete a comment ---------------- .. code-block:: http $ http DELETE https://sls-api.sheepcrm.com/comments/v2/$CONTEXT/thread/{key}/comment/{comment-uid}/ "Authorization: Bearer $API_KEY" HTTP/1.0 200 OK { "comments": { "comments": [ { "comment": "Why wouldn't they like us?", "datetime": "2021-03-02T13:04:22.711000", "uid": "204f6a060d", "user": "/sheepcrm/user/5cab33e1638e5512a16d4a1f/" } ] } }