curl --request PUT \
--url https://ds.cominty.com/memory/file \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"content": "<string>",
"purpose": "<string>"
}
'import requests
url = "https://ds.cominty.com/memory/file"
payload = {
"content": "<string>",
"purpose": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', purpose: '<string>'})
};
fetch('https://ds.cominty.com/memory/file', 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://ds.cominty.com/memory/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <api-key>"
],
]);
$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://ds.cominty.com/memory/file"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-cominty-token", "<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.put("https://ds.cominty.com/memory/file")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/memory/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"purpose": "<string>",
"namespace": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"version": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Update a memory file
Update content, purpose, or both. With an API token, namespace, path, and version are required. version is the opaque token from the last read. A stale version returns 409. A malformed version returns 422. Send only the fields you want to change. A JSON null leaves the stored value unchanged and still returns 200. There is no way to clear a field.
curl --request PUT \
--url https://ds.cominty.com/memory/file \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"content": "<string>",
"purpose": "<string>"
}
'import requests
url = "https://ds.cominty.com/memory/file"
payload = {
"content": "<string>",
"purpose": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', purpose: '<string>'})
};
fetch('https://ds.cominty.com/memory/file', 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://ds.cominty.com/memory/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <api-key>"
],
]);
$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://ds.cominty.com/memory/file"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-cominty-token", "<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.put("https://ds.cominty.com/memory/file")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/memory/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"purpose": "<string>",
"namespace": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"version": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
A Cominty Platform API secret. A key created now starts with sk-cmt-. Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix. A key created before the prefix existed has no sk-cmt- and still works.
Query Parameters
Relative path with at most one folder segment, for example notes/todo.md. a/b/todo.md returns 422.
Opaque token from the last read of this file. A stale value returns 409. A malformed value returns 422. Send it back unchanged.
Namespace the file belongs to. Required for an API token. Omitting it returns 400 Missing namespace. At most 128 characters.
128Optional. Does not select the memory namespace.
Body
Response
Successful Response
Path as stored.
Why the file exists.
Namespace the file belongs to.
When the file was created.
When the file was last updated.
File body. May be empty.
Opaque version identifier; echo back as version when updating.