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

$ http POST https://api.sheepcrm.com/api/v1/$CONTEXT/theads/ "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

$ http POST https://api.sheepcrm.com/api/v1/$CONTEXT/theads/ "Authorization: Bearer $API_KEY" title="So I have a question..." comment="Do you think these guys like us?"

View all threads

$ http GET https://api.sheepcrm.com/api/v1/$CONTEXT/theads/ "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

key

required: the thread key

$ http DELETE https://api.sheepcrm.com/api/v1/$CONTEXT/theads/ "Authorization: Bearer $API_KEY"
HTTP/1.0 200 OK

{
    "deleted": true
}

Comment on a thread

comment

required: text comment

key

required: the thread key

$ http POST https://api.sheepcrm.com/api/v1/$CONTEXT/theads/comment/ "Authorization: Bearer $API_KEY" key=8e75026d34 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

uid

required: the comment identifier

key

required: the thread key

$ http DELETE https://api.sheepcrm.com/api/v1/$CONTEXT/theads/ "Authorization: Bearer $API_KEY" key=8e75026d34 uid=f7d95f2939
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/"
            }
        ]
    }
}