Store watching time analytic for room
curl --request POST \
--url https://apix.us.amity.co/api/v3/user-event/room \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"signature": "<string>",
"nonceStr": "<string>",
"timestamp": "2021-03-10T03:07:16.127Z",
"rooms": [
{
"roomId": "<string>",
"startTime": "2021-03-10T03:07:16.127Z",
"endTime": "2021-03-10T03:07:16.127Z",
"watchSeconds": 120,
"sessionId": "<string>"
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/user-event/room"
payload = {
"signature": "<string>",
"nonceStr": "<string>",
"timestamp": "2021-03-10T03:07:16.127Z",
"rooms": [
{
"roomId": "<string>",
"startTime": "2021-03-10T03:07:16.127Z",
"endTime": "2021-03-10T03:07:16.127Z",
"watchSeconds": 120,
"sessionId": "<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({
signature: '<string>',
nonceStr: '<string>',
timestamp: '2021-03-10T03:07:16.127Z',
rooms: [
{
roomId: '<string>',
startTime: '2021-03-10T03:07:16.127Z',
endTime: '2021-03-10T03:07:16.127Z',
watchSeconds: 120,
sessionId: '<string>'
}
]
})
};
fetch('https://apix.us.amity.co/api/v3/user-event/room', 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/user-event/room",
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([
'signature' => '<string>',
'nonceStr' => '<string>',
'timestamp' => '2021-03-10T03:07:16.127Z',
'rooms' => [
[
'roomId' => '<string>',
'startTime' => '2021-03-10T03:07:16.127Z',
'endTime' => '2021-03-10T03:07:16.127Z',
'watchSeconds' => 120,
'sessionId' => '<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/user-event/room"
payload := strings.NewReader("{\n \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<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/user-event/room")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/user-event/room")
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 \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}{
"code": "500000,",
"message": "Information mismatch",
"status": "error"
}Room
Store watching time analytic for room
POST
/
api
/
v3
/
user-event
/
room
Store watching time analytic for room
curl --request POST \
--url https://apix.us.amity.co/api/v3/user-event/room \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"signature": "<string>",
"nonceStr": "<string>",
"timestamp": "2021-03-10T03:07:16.127Z",
"rooms": [
{
"roomId": "<string>",
"startTime": "2021-03-10T03:07:16.127Z",
"endTime": "2021-03-10T03:07:16.127Z",
"watchSeconds": 120,
"sessionId": "<string>"
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/user-event/room"
payload = {
"signature": "<string>",
"nonceStr": "<string>",
"timestamp": "2021-03-10T03:07:16.127Z",
"rooms": [
{
"roomId": "<string>",
"startTime": "2021-03-10T03:07:16.127Z",
"endTime": "2021-03-10T03:07:16.127Z",
"watchSeconds": 120,
"sessionId": "<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({
signature: '<string>',
nonceStr: '<string>',
timestamp: '2021-03-10T03:07:16.127Z',
rooms: [
{
roomId: '<string>',
startTime: '2021-03-10T03:07:16.127Z',
endTime: '2021-03-10T03:07:16.127Z',
watchSeconds: 120,
sessionId: '<string>'
}
]
})
};
fetch('https://apix.us.amity.co/api/v3/user-event/room', 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/user-event/room",
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([
'signature' => '<string>',
'nonceStr' => '<string>',
'timestamp' => '2021-03-10T03:07:16.127Z',
'rooms' => [
[
'roomId' => '<string>',
'startTime' => '2021-03-10T03:07:16.127Z',
'endTime' => '2021-03-10T03:07:16.127Z',
'watchSeconds' => 120,
'sessionId' => '<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/user-event/room"
payload := strings.NewReader("{\n \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<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/user-event/room")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/user-event/room")
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 \"signature\": \"<string>\",\n \"nonceStr\": \"<string>\",\n \"timestamp\": \"2021-03-10T03:07:16.127Z\",\n \"rooms\": [\n {\n \"roomId\": \"<string>\",\n \"startTime\": \"2021-03-10T03:07:16.127Z\",\n \"endTime\": \"2021-03-10T03:07:16.127Z\",\n \"watchSeconds\": 120,\n \"sessionId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}{
"code": "500000,",
"message": "Information mismatch",
"status": "error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
A group of user activity on startTime, endTime and watchSeconds.
RSA-SHA256 signature for request validation. Generated by:
- Sort data object keys alphabetically for each room
- Create key=value pairs (use ISO 8601 format for timestamps)
- Join pairs with '&' within each room
- Join multiple rooms with ';'
- Create signing string:
nonceStr={nonceStr}×tamp={timestamp}&data={dataStr}== - Sign with SHA256 using your RSA private key
- Base64 encode the signature
Example data string: endTime=2021-03-10T03:08:16.127Z&roomId=room123&sessionId=session1&startTime=2021-03-10T03:07:16.127Z&watchSeconds=60
unique string for each request, max length 50
timestamp string in UTC format
Example:
"2021-03-10T03:07:16.127Z"
Show child attributes
Show child attributes
Response
event is processed successfully
Example:
true
⌘I