Skip to main content
Add content to database
curl --request POST \
  --url https://api.example.com/add \
  --header 'Content-Type: application/json' \
  --data '
{
  "device_name": "<string>",
  "content": {
    "content_type": "<string>",
    "data": [
      {
        "file_path": "<string>",
        "timestamp": "2023-11-07T05:31:56Z",
        "app_name": "<string>",
        "window_name": "<string>",
        "ocr_results": [
          {
            "text": "<string>",
            "text_json": "<string>",
            "ocr_engine": "<string>",
            "focused": true
          }
        ],
        "tags": [
          "<string>"
        ]
      }
    ]
  }
}
'
import requests

url = "https://api.example.com/add"

payload = {
"device_name": "<string>",
"content": {
"content_type": "<string>",
"data": [
{
"file_path": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"app_name": "<string>",
"window_name": "<string>",
"ocr_results": [
{
"text": "<string>",
"text_json": "<string>",
"ocr_engine": "<string>",
"focused": True
}
],
"tags": ["<string>"]
}
]
}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
device_name: '<string>',
content: {
content_type: '<string>',
data: [
{
file_path: '<string>',
timestamp: '2023-11-07T05:31:56Z',
app_name: '<string>',
window_name: '<string>',
ocr_results: [
{text: '<string>', text_json: '<string>', ocr_engine: '<string>', focused: true}
],
tags: ['<string>']
}
]
}
})
};

fetch('https://api.example.com/add', 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.example.com/add",
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([
'device_name' => '<string>',
'content' => [
'content_type' => '<string>',
'data' => [
[
'file_path' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'app_name' => '<string>',
'window_name' => '<string>',
'ocr_results' => [
[
'text' => '<string>',
'text_json' => '<string>',
'ocr_engine' => '<string>',
'focused' => true
]
],
'tags' => [
'<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/add"

payload := strings.NewReader("{\n \"device_name\": \"<string>\",\n \"content\": {\n \"content_type\": \"<string>\",\n \"data\": [\n {\n \"file_path\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"app_name\": \"<string>\",\n \"window_name\": \"<string>\",\n \"ocr_results\": [\n {\n \"text\": \"<string>\",\n \"text_json\": \"<string>\",\n \"ocr_engine\": \"<string>\",\n \"focused\": true\n }\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

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.example.com/add")
.header("Content-Type", "application/json")
.body("{\n \"device_name\": \"<string>\",\n \"content\": {\n \"content_type\": \"<string>\",\n \"data\": [\n {\n \"file_path\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"app_name\": \"<string>\",\n \"window_name\": \"<string>\",\n \"ocr_results\": [\n {\n \"text\": \"<string>\",\n \"text_json\": \"<string>\",\n \"ocr_engine\": \"<string>\",\n \"focused\": true\n }\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/add")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_name\": \"<string>\",\n \"content\": {\n \"content_type\": \"<string>\",\n \"data\": [\n {\n \"file_path\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"app_name\": \"<string>\",\n \"window_name\": \"<string>\",\n \"ocr_results\": [\n {\n \"text\": \"<string>\",\n \"text_json\": \"<string>\",\n \"ocr_engine\": \"<string>\",\n \"focused\": true\n }\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "<string>"
}

Body

application/json
device_name
string
required
content
object
required

Response

200 - application/json

OK

success
boolean
required
message
string | null
required