Update Document Metadata
curl --request PUT \
--url https://api.wistx.ai/v1/indexing/documents/{resource_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"tags": {}
}
'import requests
url = "https://api.wistx.ai/v1/indexing/documents/{resource_id}"
payload = {
"name": "<string>",
"description": "<string>",
"tags": {}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', tags: {}})
};
fetch('https://api.wistx.ai/v1/indexing/documents/{resource_id}', 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.wistx.ai/v1/indexing/documents/{resource_id}",
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([
'name' => '<string>',
'description' => '<string>',
'tags' => [
]
]),
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.wistx.ai/v1/indexing/documents/{resource_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.wistx.ai/v1/indexing/documents/{resource_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/documents/{resource_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"resource_type": "document",
"name": "Updated Document Name",
"description": "Updated description",
"tags": ["updated", "tag"],
"status": "completed",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"detail": "Resource not found or access denied"
}
{
"error": {
"code": "UPDATE_ERROR",
"message": "Failed to update document metadata",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Indexing
Update Document Metadata
Update document metadata (name, description, tags) without re-indexing
PUT
/
v1
/
indexing
/
documents
/
{resource_id}
Update Document Metadata
curl --request PUT \
--url https://api.wistx.ai/v1/indexing/documents/{resource_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"tags": {}
}
'import requests
url = "https://api.wistx.ai/v1/indexing/documents/{resource_id}"
payload = {
"name": "<string>",
"description": "<string>",
"tags": {}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', tags: {}})
};
fetch('https://api.wistx.ai/v1/indexing/documents/{resource_id}', 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.wistx.ai/v1/indexing/documents/{resource_id}",
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([
'name' => '<string>',
'description' => '<string>',
'tags' => [
]
]),
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.wistx.ai/v1/indexing/documents/{resource_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.wistx.ai/v1/indexing/documents/{resource_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/documents/{resource_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {}\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"resource_type": "document",
"name": "Updated Document Name",
"description": "Updated description",
"tags": ["updated", "tag"],
"status": "completed",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"detail": "Resource not found or access denied"
}
{
"error": {
"code": "UPDATE_ERROR",
"message": "Failed to update document metadata",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Update document metadata (name, description, tags) without re-indexing
curl --request PUT \
--url https://api.wistx.ai/v1/indexing/documents/res_abc123 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Updated Document Name",
"description": "Updated description",
"tags": ["updated", "tag"]
}'
import requests
api_key = "YOUR_API_KEY"
resource_id = "res_abc123"
response = requests.put(
f"https://api.wistx.ai/v1/indexing/documents/{resource_id}",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"name": "Updated Document Name",
"description": "Updated description",
"tags": ["updated", "tag"]
}
)
resource = response.json()
print(f"Updated: {resource['name']}")
const apiKey = "YOUR_API_KEY";
const resourceId = "res_abc123";
const response = await fetch(
`https://api.wistx.ai/v1/indexing/documents/${resourceId}`,
{
method: "PUT",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "Updated Document Name",
description: "Updated description",
tags: ["updated", "tag"]
})
}
);
const resource = await response.json();
console.log(`Updated: ${resource.name}`);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
apiKey := "YOUR_API_KEY"
resourceID := "res_abc123"
url := fmt.Sprintf("https://api.wistx.ai/v1/indexing/documents/%s", resourceID)
payload := map[string]interface{}{
"name": "Updated Document Name",
"description": "Updated description",
"tags": []string{"updated", "tag"},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var resource map[string]interface{}
json.NewDecoder(resp.Body).Decode(&resource)
fmt.Printf("Updated: %v\n", resource["name"])
}
require 'net/http'
require 'json'
require 'uri'
api_key = "YOUR_API_KEY"
resource_id = "res_abc123"
url = URI("https://api.wistx.ai/v1/indexing/documents/#{resource_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request.body = {
name: "Updated Document Name",
description: "Updated description",
tags: ["updated", "tag"]
}.to_json
response = http.request(request)
resource = JSON.parse(response.body)
puts "Updated: #{resource['name']}"
<?php
$apiKey = "YOUR_API_KEY";
$resourceId = "res_abc123";
$url = "https://api.wistx.ai/v1/indexing/documents/" . $resourceId;
$data = [
"name" => "Updated Document Name",
"description" => "Updated description",
"tags" => ["updated", "tag"]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $apiKey,
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
$resource = json_decode($response, true);
echo "Updated: " . $resource['name'];
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class UpdateDocumentMetadata {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY";
String resourceId = "res_abc123";
URL url = new URL("https://api.wistx.ai/v1/indexing/documents/" + resourceId);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("PUT");
conn.setRequestProperty("Authorization", "Bearer " + apiKey);
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JsonObject payload = new JsonObject();
payload.addProperty("name", "Updated Document Name");
payload.addProperty("description", "Updated description");
Gson gson = new Gson();
String[] tags = {"updated", "tag"};
payload.add("tags", gson.toJsonTree(tags));
try (OutputStream os = conn.getOutputStream()) {
byte[] input = gson.toJson(payload).getBytes("utf-8");
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
}
Path Parameters
string
required
Resource ID of the document to update.
Request Parameters
string
Updated document name.
string
Updated document description.
array[string]
Updated tags array.
Response
{
"resource_id": "res_abc123",
"resource_type": "document",
"name": "Updated Document Name",
"description": "Updated description",
"tags": ["updated", "tag"],
"status": "completed",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"detail": "Resource not found or access denied"
}
{
"error": {
"code": "UPDATE_ERROR",
"message": "Failed to update document metadata",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Related Endpoints
- Replace Document Content - Replace document content
- Re-index Document - Re-index document
- Get Resource Status - Check resource status