create a comment.
curl --request POST \
--url https://apix.us.amity.co/api/v3/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"referenceId": "<string>",
"referenceType": "post",
"data": {
"text": "<string>"
},
"metadata": {},
"links": [
{
"url": "<string>",
"index": 1,
"length": 2,
"renderPreview": false,
"domain": "<string>",
"title": "<string>",
"imageUrl": "<string>"
}
],
"commentId": "<string>",
"parentId": "<string>",
"mentionees": [
{
"type": "user",
"userIds": [
"userId1",
"userId2"
]
}
],
"createdAt": "2022-07-07T04:24:20.444Z",
"attachments": [
{
"fileId": "<string>"
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/comments"
payload = {
"referenceId": "<string>",
"referenceType": "post",
"data": { "text": "<string>" },
"metadata": {},
"links": [
{
"url": "<string>",
"index": 1,
"length": 2,
"renderPreview": False,
"domain": "<string>",
"title": "<string>",
"imageUrl": "<string>"
}
],
"commentId": "<string>",
"parentId": "<string>",
"mentionees": [
{
"type": "user",
"userIds": ["userId1", "userId2"]
}
],
"createdAt": "2022-07-07T04:24:20.444Z",
"attachments": [{ "fileId": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referenceId: '<string>',
referenceType: 'post',
data: {text: '<string>'},
metadata: {},
links: [
{
url: '<string>',
index: 1,
length: 2,
renderPreview: false,
domain: '<string>',
title: '<string>',
imageUrl: '<string>'
}
],
commentId: '<string>',
parentId: '<string>',
mentionees: [{type: 'user', userIds: ['userId1', 'userId2']}],
createdAt: '2022-07-07T04:24:20.444Z',
attachments: [{fileId: '<string>'}]
})
};
fetch('https://apix.us.amity.co/api/v3/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v3/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'referenceId' => '<string>',
'referenceType' => 'post',
'data' => [
'text' => '<string>'
],
'metadata' => [
],
'links' => [
[
'url' => '<string>',
'index' => 1,
'length' => 2,
'renderPreview' => false,
'domain' => '<string>',
'title' => '<string>',
'imageUrl' => '<string>'
]
],
'commentId' => '<string>',
'parentId' => '<string>',
'mentionees' => [
[
'type' => 'user',
'userIds' => [
'userId1',
'userId2'
]
]
],
'createdAt' => '2022-07-07T04:24:20.444Z',
'attachments' => [
[
'fileId' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v3/comments"
payload := strings.NewReader("{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apix.us.amity.co/api/v3/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"comments": [
{
"commentId": "<string>",
"_id": "<string>",
"path": "<string>",
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"parentId": "<string>",
"rootId": "<string>",
"referenceId": "<string>",
"dataType": "<string>",
"dataTypes": [],
"data": {},
"metadata": {},
"childrenNumber": 123,
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"reactions": {
"like": 1
},
"reactionsCount": 1,
"myReactions": [
"like"
],
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"children": [
"<string>"
],
"segmentNumber": 1,
"mentionees": [
{
"type": "user",
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
],
"attachments": [
{
"fileId": "<string>"
}
],
"targetId": "<string>"
}
],
"commentChildren": [
{
"commentId": "<string>",
"_id": "<string>",
"path": "<string>",
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"parentId": "<string>",
"rootId": "<string>",
"referenceId": "<string>",
"dataType": "<string>",
"dataTypes": [],
"data": {},
"metadata": {},
"childrenNumber": 123,
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"reactions": {
"like": 1
},
"reactionsCount": 1,
"myReactions": [
"like"
],
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"children": [
"<string>"
],
"segmentNumber": 1,
"mentionees": [
{
"type": "user",
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
],
"attachments": [
{
"fileId": "<string>"
}
],
"targetId": "<string>"
}
],
"communityUsers": [
{
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"channelId": "<string>",
"communityId": "<string>",
"notMemberReason": "<string>",
"isBanned": false,
"lastActivity": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"permissions": [],
"lastJoin": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"roles": [
{
"roleId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"isDeleted": false,
"displayName": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"files": [
{
"fileId": "<string>",
"fileUrl": "<string>",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "<string>",
"extension": "<string>",
"size": 123,
"mimeType": "<string>",
"metadata": {
"exif": {},
"gps": {},
"height": 123,
"width": 123,
"isFull": true
}
}
}
]
}{
"status": "error",
"code": 400000,
"message": "Bad Request."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 400311,
"message": "RateLimit Exceed."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Comment
create a comment.
POST
/
api
/
v3
/
comments
create a comment.
curl --request POST \
--url https://apix.us.amity.co/api/v3/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"referenceId": "<string>",
"referenceType": "post",
"data": {
"text": "<string>"
},
"metadata": {},
"links": [
{
"url": "<string>",
"index": 1,
"length": 2,
"renderPreview": false,
"domain": "<string>",
"title": "<string>",
"imageUrl": "<string>"
}
],
"commentId": "<string>",
"parentId": "<string>",
"mentionees": [
{
"type": "user",
"userIds": [
"userId1",
"userId2"
]
}
],
"createdAt": "2022-07-07T04:24:20.444Z",
"attachments": [
{
"fileId": "<string>"
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/comments"
payload = {
"referenceId": "<string>",
"referenceType": "post",
"data": { "text": "<string>" },
"metadata": {},
"links": [
{
"url": "<string>",
"index": 1,
"length": 2,
"renderPreview": False,
"domain": "<string>",
"title": "<string>",
"imageUrl": "<string>"
}
],
"commentId": "<string>",
"parentId": "<string>",
"mentionees": [
{
"type": "user",
"userIds": ["userId1", "userId2"]
}
],
"createdAt": "2022-07-07T04:24:20.444Z",
"attachments": [{ "fileId": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referenceId: '<string>',
referenceType: 'post',
data: {text: '<string>'},
metadata: {},
links: [
{
url: '<string>',
index: 1,
length: 2,
renderPreview: false,
domain: '<string>',
title: '<string>',
imageUrl: '<string>'
}
],
commentId: '<string>',
parentId: '<string>',
mentionees: [{type: 'user', userIds: ['userId1', 'userId2']}],
createdAt: '2022-07-07T04:24:20.444Z',
attachments: [{fileId: '<string>'}]
})
};
fetch('https://apix.us.amity.co/api/v3/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v3/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'referenceId' => '<string>',
'referenceType' => 'post',
'data' => [
'text' => '<string>'
],
'metadata' => [
],
'links' => [
[
'url' => '<string>',
'index' => 1,
'length' => 2,
'renderPreview' => false,
'domain' => '<string>',
'title' => '<string>',
'imageUrl' => '<string>'
]
],
'commentId' => '<string>',
'parentId' => '<string>',
'mentionees' => [
[
'type' => 'user',
'userIds' => [
'userId1',
'userId2'
]
]
],
'createdAt' => '2022-07-07T04:24:20.444Z',
'attachments' => [
[
'fileId' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v3/comments"
payload := strings.NewReader("{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apix.us.amity.co/api/v3/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referenceId\": \"<string>\",\n \"referenceType\": \"post\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"metadata\": {},\n \"links\": [\n {\n \"url\": \"<string>\",\n \"index\": 1,\n \"length\": 2,\n \"renderPreview\": false,\n \"domain\": \"<string>\",\n \"title\": \"<string>\",\n \"imageUrl\": \"<string>\"\n }\n ],\n \"commentId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"mentionees\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"userId1\",\n \"userId2\"\n ]\n }\n ],\n \"createdAt\": \"2022-07-07T04:24:20.444Z\",\n \"attachments\": [\n {\n \"fileId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"comments": [
{
"commentId": "<string>",
"_id": "<string>",
"path": "<string>",
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"parentId": "<string>",
"rootId": "<string>",
"referenceId": "<string>",
"dataType": "<string>",
"dataTypes": [],
"data": {},
"metadata": {},
"childrenNumber": 123,
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"reactions": {
"like": 1
},
"reactionsCount": 1,
"myReactions": [
"like"
],
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"children": [
"<string>"
],
"segmentNumber": 1,
"mentionees": [
{
"type": "user",
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
],
"attachments": [
{
"fileId": "<string>"
}
],
"targetId": "<string>"
}
],
"commentChildren": [
{
"commentId": "<string>",
"_id": "<string>",
"path": "<string>",
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"parentId": "<string>",
"rootId": "<string>",
"referenceId": "<string>",
"dataType": "<string>",
"dataTypes": [],
"data": {},
"metadata": {},
"childrenNumber": 123,
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"reactions": {
"like": 1
},
"reactionsCount": 1,
"myReactions": [
"like"
],
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"children": [
"<string>"
],
"segmentNumber": 1,
"mentionees": [
{
"type": "user",
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
],
"attachments": [
{
"fileId": "<string>"
}
],
"targetId": "<string>"
}
],
"communityUsers": [
{
"userId": "<string>",
"userPublicId": "<string>",
"userInternalId": "<string>",
"channelId": "<string>",
"communityId": "<string>",
"notMemberReason": "<string>",
"isBanned": false,
"lastActivity": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"permissions": [],
"lastJoin": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"roles": [
{
"roleId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"isDeleted": false,
"displayName": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"files": [
{
"fileId": "<string>",
"fileUrl": "<string>",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "<string>",
"extension": "<string>",
"size": 123,
"mimeType": "<string>",
"metadata": {
"exif": {},
"gps": {},
"height": 123,
"width": 123,
"isFull": true
}
}
}
]
}{
"status": "error",
"code": 400000,
"message": "Bad Request."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 400311,
"message": "RateLimit Exceed."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
information of a comment to be created.
Maximum string length:
900Available options:
post, content, story Show child attributes
Show child attributes
Array of URL links extracted from content with metadata for link preview rendering
Maximum array length:
100Show child attributes
Show child attributes
Maximum string length:
900Maximum string length:
900The object of the mentions type and user who get a notification from the post.
Show child attributes
Show child attributes
The date/time when a comment is created.
Example:
"2022-07-07T04:24:20.444Z"
The attachments/medias to be included in the comment
Show child attributes
Show child attributes
⌘I