Create a report
curl --request POST \
--url https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"type": "user",
"externalId": "user_789",
"display": {
"name": "Jane Doe",
"username": "janedoe"
}
},
"reporter": {
"type": "user",
"externalId": "user_123"
},
"target": {
"contentExternalId": "post_456",
"contentType": "post"
},
"reason": {
"names": [
"harassment"
]
},
"description": "This post contains targeted harassment.",
"automated": false
}
'import requests
url = "https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports"
payload = {
"subject": {
"type": "user",
"externalId": "user_789",
"display": {
"name": "Jane Doe",
"username": "janedoe"
}
},
"reporter": {
"type": "user",
"externalId": "user_123"
},
"target": {
"contentExternalId": "post_456",
"contentType": "post"
},
"reason": { "names": ["harassment"] },
"description": "This post contains targeted harassment.",
"automated": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {
type: 'user',
externalId: 'user_789',
display: {name: 'Jane Doe', username: 'janedoe'}
},
reporter: {type: 'user', externalId: 'user_123'},
target: {contentExternalId: 'post_456', contentType: 'post'},
reason: {names: ['harassment']},
description: 'This post contains targeted harassment.',
automated: false
})
};
fetch('https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports', 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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports",
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([
'subject' => [
'type' => 'user',
'externalId' => 'user_789',
'display' => [
'name' => 'Jane Doe',
'username' => 'janedoe'
]
],
'reporter' => [
'type' => 'user',
'externalId' => 'user_123'
],
'target' => [
'contentExternalId' => 'post_456',
'contentType' => 'post'
],
'reason' => [
'names' => [
'harassment'
]
],
'description' => 'This post contains targeted harassment.',
'automated' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports"
payload := strings.NewReader("{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}"
response = http.request(request)
puts response.read_body{
"report": {
"id": "<string>",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Reports
Create a report
Submits a new moderation report for content within a project. Upserts the subject and reporter identities automatically.
POST
/
projects
/
{projectId}
/
reports
Create a report
curl --request POST \
--url https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"type": "user",
"externalId": "user_789",
"display": {
"name": "Jane Doe",
"username": "janedoe"
}
},
"reporter": {
"type": "user",
"externalId": "user_123"
},
"target": {
"contentExternalId": "post_456",
"contentType": "post"
},
"reason": {
"names": [
"harassment"
]
},
"description": "This post contains targeted harassment.",
"automated": false
}
'import requests
url = "https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports"
payload = {
"subject": {
"type": "user",
"externalId": "user_789",
"display": {
"name": "Jane Doe",
"username": "janedoe"
}
},
"reporter": {
"type": "user",
"externalId": "user_123"
},
"target": {
"contentExternalId": "post_456",
"contentType": "post"
},
"reason": { "names": ["harassment"] },
"description": "This post contains targeted harassment.",
"automated": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {
type: 'user',
externalId: 'user_789',
display: {name: 'Jane Doe', username: 'janedoe'}
},
reporter: {type: 'user', externalId: 'user_123'},
target: {contentExternalId: 'post_456', contentType: 'post'},
reason: {names: ['harassment']},
description: 'This post contains targeted harassment.',
automated: false
})
};
fetch('https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports', 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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports",
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([
'subject' => [
'type' => 'user',
'externalId' => 'user_789',
'display' => [
'name' => 'Jane Doe',
'username' => 'janedoe'
]
],
'reporter' => [
'type' => 'user',
'externalId' => 'user_123'
],
'target' => [
'contentExternalId' => 'post_456',
'contentType' => 'post'
],
'reason' => [
'names' => [
'harassment'
]
],
'description' => 'This post contains targeted harassment.',
'automated' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports"
payload := strings.NewReader("{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kansato.com/sdk/whistle/v1/projects/{projectId}/reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subject\": {\n \"type\": \"user\",\n \"externalId\": \"user_789\",\n \"display\": {\n \"name\": \"Jane Doe\",\n \"username\": \"janedoe\"\n }\n },\n \"reporter\": {\n \"type\": \"user\",\n \"externalId\": \"user_123\"\n },\n \"target\": {\n \"contentExternalId\": \"post_456\",\n \"contentType\": \"post\"\n },\n \"reason\": {\n \"names\": [\n \"harassment\"\n ]\n },\n \"description\": \"This post contains targeted harassment.\",\n \"automated\": false\n}"
response = http.request(request)
puts response.read_body{
"report": {
"id": "<string>",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
API key with wh_ prefix. Send as Bearer token: Authorization: Bearer wh_xxxxxxxxxxxx
Path Parameters
Project UUID
Body
application/json
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Report reason(s). Use names array or single name string.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether this report was generated automatically
Response
Report created
Show child attributes
Show child attributes
⌘I

