Re-index Document
curl --request POST \
--url https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex \
--header 'Content-Type: application/json' \
--data '{
"force": true
}'import requests
url = "https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex"
payload = { "force": True }
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({force: true})
};
fetch('https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex', 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}/reindex",
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([
'force' => true
]),
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}/reindex"
payload := strings.NewReader("{\n \"force\": true\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.wistx.ai/v1/indexing/documents/{resource_id}/reindex")
.header("Content-Type", "application/json")
.body("{\n \"force\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex")
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 \"force\": true\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"resource_type": "document",
"status": "indexing",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Document re-indexing queued"
},
"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": "REINDEX_ERROR",
"message": "Failed to re-index document",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Indexing
Re-index Document
Re-index an existing document with latest processing logic
POST
/
v1
/
indexing
/
documents
/
{resource_id}
/
reindex
Re-index Document
curl --request POST \
--url https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex \
--header 'Content-Type: application/json' \
--data '{
"force": true
}'import requests
url = "https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex"
payload = { "force": True }
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({force: true})
};
fetch('https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex', 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}/reindex",
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([
'force' => true
]),
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}/reindex"
payload := strings.NewReader("{\n \"force\": true\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.wistx.ai/v1/indexing/documents/{resource_id}/reindex")
.header("Content-Type", "application/json")
.body("{\n \"force\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex")
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 \"force\": true\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"resource_type": "document",
"status": "indexing",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Document re-indexing queued"
},
"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": "REINDEX_ERROR",
"message": "Failed to re-index document",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Re-index an existing document with latest processing logic
curl --request POST \
--url https://api.wistx.ai/v1/indexing/documents/res_abc123/reindex \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"force": false
}'
import requests
api_key = "YOUR_API_KEY"
resource_id = "res_abc123"
response = requests.post(
f"https://api.wistx.ai/v1/indexing/documents/{resource_id}/reindex",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={"force": False}
)
resource = response.json()
print(f"Re-indexing started: {resource['status']}")
const apiKey = "YOUR_API_KEY";
const resourceId = "res_abc123";
const response = await fetch(
`https://api.wistx.ai/v1/indexing/documents/${resourceId}/reindex`,
{
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
force: false
})
}
);
const resource = await response.json();
console.log(`Re-indexing started: ${resource.status}`);
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/reindex", resourceID)
payload := map[string]interface{}{
"force": false,
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", 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("Re-indexing started: %v\n", resource["status"])
}
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}/reindex")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request.body = {
force: false
}.to_json
response = http.request(request)
resource = JSON.parse(response.body)
puts "Re-indexing started: #{resource['status']}"
<?php
$apiKey = "YOUR_API_KEY";
$resourceId = "res_abc123";
$url = "https://api.wistx.ai/v1/indexing/documents/" . $resourceId . "/reindex";
$data = [
"force" => false
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
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 "Re-indexing started: " . $resource['status'];
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 ReindexDocument {
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 + "/reindex");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer " + apiKey);
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JsonObject payload = new JsonObject();
payload.addProperty("force", false);
Gson gson = new Gson();
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 re-index.
Request Parameters
boolean
Force re-indexing even if document hasn’t changed.Default:
falseResponse
{
"resource_id": "res_abc123",
"resource_type": "document",
"status": "indexing",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Document re-indexing queued"
},
"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": "REINDEX_ERROR",
"message": "Failed to re-index document",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Related Endpoints
- Update Document Metadata - Update metadata only
- Replace Document Content - Replace content
- Get Resource Status - Check resource status