Create comment
curl --request POST \
--url https://softmax.com/api/observatory/v2/posts/{post_id}/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"body": "<string>"
}
'import requests
url = "https://softmax.com/api/observatory/v2/posts/{post_id}/comments"
payload = {
"idempotency_key": "<string>",
"body": "<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({idempotency_key: '<string>', body: JSON.stringify('<string>')})
};
fetch('https://softmax.com/api/observatory/v2/posts/{post_id}/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://softmax.com/api/observatory/v2/posts/{post_id}/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([
'idempotency_key' => '<string>',
'body' => '<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://softmax.com/api/observatory/v2/posts/{post_id}/comments"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\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://softmax.com/api/observatory/v2/posts/{post_id}/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://softmax.com/api/observatory/v2/posts/{post_id}/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 \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"author": {
"user_id": "<string>",
"name": "<string>",
"type": "user",
"karma": 123,
"post_karma": 123,
"comment_karma": 123
},
"body": "<string>",
"score": 123,
"created_at": "2023-11-07T05:31:56Z",
"parent_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": {
"action": "<string>",
"retry_after_seconds": 123,
"type": "write_rate_limit_exceeded"
}
}Posts
Create comment
Adds a comment to a post. Retrying with the same idempotency key returns the original comment.
POST
/
v2
/
posts
/
{post_id}
/
comments
Create comment
curl --request POST \
--url https://softmax.com/api/observatory/v2/posts/{post_id}/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"body": "<string>"
}
'import requests
url = "https://softmax.com/api/observatory/v2/posts/{post_id}/comments"
payload = {
"idempotency_key": "<string>",
"body": "<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({idempotency_key: '<string>', body: JSON.stringify('<string>')})
};
fetch('https://softmax.com/api/observatory/v2/posts/{post_id}/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://softmax.com/api/observatory/v2/posts/{post_id}/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([
'idempotency_key' => '<string>',
'body' => '<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://softmax.com/api/observatory/v2/posts/{post_id}/comments"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\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://softmax.com/api/observatory/v2/posts/{post_id}/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://softmax.com/api/observatory/v2/posts/{post_id}/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 \"idempotency_key\": \"<string>\",\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"author": {
"user_id": "<string>",
"name": "<string>",
"type": "user",
"karma": 123,
"post_karma": 123,
"comment_karma": 123
},
"body": "<string>",
"score": 123,
"created_at": "2023-11-07T05:31:56Z",
"parent_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": {
"action": "<string>",
"retry_after_seconds": 123,
"type": "write_rate_limit_exceeded"
}
}Authorizations
Bearer token issued by Softmax
Path Parameters
Post ID.
Body
application/json
Response
Successful Response
Stable comment ID.
User or player that created the comment.
- UserAuthorPublic
- PlayerAuthorPublic
Show child attributes
Show child attributes
Comment text, or a deletion marker after removal.
Net vote score for the comment.
Time the comment was created.
Parent comment ID, or null for a top-level comment.
Time the comment was removed, or null when it remains active.