Vectara REST API
POST
CreateCorpus
{{baseUrl}}/v1/create-corpus
HEADERS
customer-id
BODY json
{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/create-corpus");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/create-corpus" {:headers {:customer-id ""}
:content-type :json
:form-params {:corpus {:customDimensions [{:description ""
:indexingDefault ""
:name ""
:servingDefault ""}]
:description ""
:dtProvision ""
:enabled false
:encoderId ""
:encrypted false
:filterAttributes [{:description ""
:indexed false
:level ""
:name ""
:type ""}]
:id 0
:metadataMaxBytes 0
:name ""
:swapIenc false
:swapQenc false
:textless false}}})
require "http/client"
url = "{{baseUrl}}/v1/create-corpus"
headers = HTTP::Headers{
"customer-id" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/create-corpus"),
Headers =
{
{ "customer-id", "" },
},
Content = new StringContent("{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/create-corpus");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/create-corpus"
payload := strings.NewReader("{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/create-corpus HTTP/1.1
Customer-Id:
Content-Type: application/json
Host: example.com
Content-Length: 576
{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/create-corpus")
.setHeader("customer-id", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/create-corpus"))
.header("customer-id", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/create-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/create-corpus")
.header("customer-id", "")
.header("content-type", "application/json")
.body("{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}")
.asString();
const data = JSON.stringify({
corpus: {
customDimensions: [
{
description: '',
indexingDefault: '',
name: '',
servingDefault: ''
}
],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [
{
description: '',
indexed: false,
level: '',
name: '',
type: ''
}
],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/create-corpus');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/create-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {
corpus: {
customDimensions: [{description: '', indexingDefault: '', name: '', servingDefault: ''}],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [{description: '', indexed: false, level: '', name: '', type: ''}],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/create-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpus":{"customDimensions":[{"description":"","indexingDefault":"","name":"","servingDefault":""}],"description":"","dtProvision":"","enabled":false,"encoderId":"","encrypted":false,"filterAttributes":[{"description":"","indexed":false,"level":"","name":"","type":""}],"id":0,"metadataMaxBytes":0,"name":"","swapIenc":false,"swapQenc":false,"textless":false}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/create-corpus',
method: 'POST',
headers: {
'customer-id': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corpus": {\n "customDimensions": [\n {\n "description": "",\n "indexingDefault": "",\n "name": "",\n "servingDefault": ""\n }\n ],\n "description": "",\n "dtProvision": "",\n "enabled": false,\n "encoderId": "",\n "encrypted": false,\n "filterAttributes": [\n {\n "description": "",\n "indexed": false,\n "level": "",\n "name": "",\n "type": ""\n }\n ],\n "id": 0,\n "metadataMaxBytes": 0,\n "name": "",\n "swapIenc": false,\n "swapQenc": false,\n "textless": false\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/create-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/create-corpus',
headers: {
'customer-id': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
corpus: {
customDimensions: [{description: '', indexingDefault: '', name: '', servingDefault: ''}],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [{description: '', indexed: false, level: '', name: '', type: ''}],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/create-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: {
corpus: {
customDimensions: [{description: '', indexingDefault: '', name: '', servingDefault: ''}],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [{description: '', indexed: false, level: '', name: '', type: ''}],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/create-corpus');
req.headers({
'customer-id': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
corpus: {
customDimensions: [
{
description: '',
indexingDefault: '',
name: '',
servingDefault: ''
}
],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [
{
description: '',
indexed: false,
level: '',
name: '',
type: ''
}
],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/create-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {
corpus: {
customDimensions: [{description: '', indexingDefault: '', name: '', servingDefault: ''}],
description: '',
dtProvision: '',
enabled: false,
encoderId: '',
encrypted: false,
filterAttributes: [{description: '', indexed: false, level: '', name: '', type: ''}],
id: 0,
metadataMaxBytes: 0,
name: '',
swapIenc: false,
swapQenc: false,
textless: false
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/create-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpus":{"customDimensions":[{"description":"","indexingDefault":"","name":"","servingDefault":""}],"description":"","dtProvision":"","enabled":false,"encoderId":"","encrypted":false,"filterAttributes":[{"description":"","indexed":false,"level":"","name":"","type":""}],"id":0,"metadataMaxBytes":0,"name":"","swapIenc":false,"swapQenc":false,"textless":false}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corpus": @{ @"customDimensions": @[ @{ @"description": @"", @"indexingDefault": @"", @"name": @"", @"servingDefault": @"" } ], @"description": @"", @"dtProvision": @"", @"enabled": @NO, @"encoderId": @"", @"encrypted": @NO, @"filterAttributes": @[ @{ @"description": @"", @"indexed": @NO, @"level": @"", @"name": @"", @"type": @"" } ], @"id": @0, @"metadataMaxBytes": @0, @"name": @"", @"swapIenc": @NO, @"swapQenc": @NO, @"textless": @NO } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/create-corpus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/create-corpus" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/create-corpus",
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([
'corpus' => [
'customDimensions' => [
[
'description' => '',
'indexingDefault' => '',
'name' => '',
'servingDefault' => ''
]
],
'description' => '',
'dtProvision' => '',
'enabled' => null,
'encoderId' => '',
'encrypted' => null,
'filterAttributes' => [
[
'description' => '',
'indexed' => null,
'level' => '',
'name' => '',
'type' => ''
]
],
'id' => 0,
'metadataMaxBytes' => 0,
'name' => '',
'swapIenc' => null,
'swapQenc' => null,
'textless' => null
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/create-corpus', [
'body' => '{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/create-corpus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corpus' => [
'customDimensions' => [
[
'description' => '',
'indexingDefault' => '',
'name' => '',
'servingDefault' => ''
]
],
'description' => '',
'dtProvision' => '',
'enabled' => null,
'encoderId' => '',
'encrypted' => null,
'filterAttributes' => [
[
'description' => '',
'indexed' => null,
'level' => '',
'name' => '',
'type' => ''
]
],
'id' => 0,
'metadataMaxBytes' => 0,
'name' => '',
'swapIenc' => null,
'swapQenc' => null,
'textless' => null
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corpus' => [
'customDimensions' => [
[
'description' => '',
'indexingDefault' => '',
'name' => '',
'servingDefault' => ''
]
],
'description' => '',
'dtProvision' => '',
'enabled' => null,
'encoderId' => '',
'encrypted' => null,
'filterAttributes' => [
[
'description' => '',
'indexed' => null,
'level' => '',
'name' => '',
'type' => ''
]
],
'id' => 0,
'metadataMaxBytes' => 0,
'name' => '',
'swapIenc' => null,
'swapQenc' => null,
'textless' => null
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/create-corpus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/create-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/create-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"
headers = {
'customer-id': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/create-corpus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/create-corpus"
payload = { "corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": False,
"encoderId": "",
"encrypted": False,
"filterAttributes": [
{
"description": "",
"indexed": False,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": False,
"swapQenc": False,
"textless": False
} }
headers = {
"customer-id": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/create-corpus"
payload <- "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/create-corpus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/create-corpus') do |req|
req.headers['customer-id'] = ''
req.body = "{\n \"corpus\": {\n \"customDimensions\": [\n {\n \"description\": \"\",\n \"indexingDefault\": \"\",\n \"name\": \"\",\n \"servingDefault\": \"\"\n }\n ],\n \"description\": \"\",\n \"dtProvision\": \"\",\n \"enabled\": false,\n \"encoderId\": \"\",\n \"encrypted\": false,\n \"filterAttributes\": [\n {\n \"description\": \"\",\n \"indexed\": false,\n \"level\": \"\",\n \"name\": \"\",\n \"type\": \"\"\n }\n ],\n \"id\": 0,\n \"metadataMaxBytes\": 0,\n \"name\": \"\",\n \"swapIenc\": false,\n \"swapQenc\": false,\n \"textless\": false\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/create-corpus";
let payload = json!({"corpus": json!({
"customDimensions": (
json!({
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
})
),
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": (
json!({
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
})
),
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/create-corpus \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--data '{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}'
echo '{
"corpus": {
"customDimensions": [
{
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
}
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
{
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
}
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
}
}' | \
http POST {{baseUrl}}/v1/create-corpus \
content-type:application/json \
customer-id:''
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'content-type: application/json' \
--body-data '{\n "corpus": {\n "customDimensions": [\n {\n "description": "",\n "indexingDefault": "",\n "name": "",\n "servingDefault": ""\n }\n ],\n "description": "",\n "dtProvision": "",\n "enabled": false,\n "encoderId": "",\n "encrypted": false,\n "filterAttributes": [\n {\n "description": "",\n "indexed": false,\n "level": "",\n "name": "",\n "type": ""\n }\n ],\n "id": 0,\n "metadataMaxBytes": 0,\n "name": "",\n "swapIenc": false,\n "swapQenc": false,\n "textless": false\n }\n}' \
--output-document \
- {{baseUrl}}/v1/create-corpus
import Foundation
let headers = [
"customer-id": "",
"content-type": "application/json"
]
let parameters = ["corpus": [
"customDimensions": [
[
"description": "",
"indexingDefault": "",
"name": "",
"servingDefault": ""
]
],
"description": "",
"dtProvision": "",
"enabled": false,
"encoderId": "",
"encrypted": false,
"filterAttributes": [
[
"description": "",
"indexed": false,
"level": "",
"name": "",
"type": ""
]
],
"id": 0,
"metadataMaxBytes": 0,
"name": "",
"swapIenc": false,
"swapQenc": false,
"textless": false
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/create-corpus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
DeleteCorpus
{{baseUrl}}/v1/delete-corpus
HEADERS
customer-id
BODY json
{
"corpusId": 0,
"customerId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/delete-corpus");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/delete-corpus" {:headers {:customer-id ""}
:content-type :json
:form-params {:corpusId 0
:customerId 0}})
require "http/client"
url = "{{baseUrl}}/v1/delete-corpus"
headers = HTTP::Headers{
"customer-id" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/delete-corpus"),
Headers =
{
{ "customer-id", "" },
},
Content = new StringContent("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/delete-corpus");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corpusId\": 0,\n \"customerId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/delete-corpus"
payload := strings.NewReader("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/delete-corpus HTTP/1.1
Customer-Id:
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"corpusId": 0,
"customerId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/delete-corpus")
.setHeader("customer-id", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/delete-corpus"))
.header("customer-id", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corpusId\": 0,\n \"customerId\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/delete-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/delete-corpus")
.header("customer-id", "")
.header("content-type", "application/json")
.body("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
.asString();
const data = JSON.stringify({
corpusId: 0,
customerId: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/delete-corpus');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {corpusId: 0, customerId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/delete-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpusId":0,"customerId":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/delete-corpus',
method: 'POST',
headers: {
'customer-id': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corpusId": 0,\n "customerId": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/delete-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/delete-corpus',
headers: {
'customer-id': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({corpusId: 0, customerId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: {corpusId: 0, customerId: 0},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/delete-corpus');
req.headers({
'customer-id': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
corpusId: 0,
customerId: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {corpusId: 0, customerId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/delete-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpusId":0,"customerId":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corpusId": @0,
@"customerId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/delete-corpus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/delete-corpus" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corpusId\": 0,\n \"customerId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/delete-corpus",
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([
'corpusId' => 0,
'customerId' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/delete-corpus', [
'body' => '{
"corpusId": 0,
"customerId": 0
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/delete-corpus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corpusId' => 0,
'customerId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corpusId' => 0,
'customerId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v1/delete-corpus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/delete-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": 0,
"customerId": 0
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/delete-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": 0,
"customerId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
headers = {
'customer-id': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/delete-corpus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/delete-corpus"
payload = {
"corpusId": 0,
"customerId": 0
}
headers = {
"customer-id": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/delete-corpus"
payload <- "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/delete-corpus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/delete-corpus') do |req|
req.headers['customer-id'] = ''
req.body = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/delete-corpus";
let payload = json!({
"corpusId": 0,
"customerId": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/delete-corpus \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--data '{
"corpusId": 0,
"customerId": 0
}'
echo '{
"corpusId": 0,
"customerId": 0
}' | \
http POST {{baseUrl}}/v1/delete-corpus \
content-type:application/json \
customer-id:''
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'content-type: application/json' \
--body-data '{\n "corpusId": 0,\n "customerId": 0\n}' \
--output-document \
- {{baseUrl}}/v1/delete-corpus
import Foundation
let headers = [
"customer-id": "",
"content-type": "application/json"
]
let parameters = [
"corpusId": 0,
"customerId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/delete-corpus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ListCorpora
{{baseUrl}}/v1/list-corpora
HEADERS
customer-id
BODY json
{
"filter": "",
"numResults": 0,
"pageKey": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/list-corpora");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/list-corpora" {:headers {:customer-id ""}
:content-type :json
:form-params {:filter ""
:numResults 0
:pageKey ""}})
require "http/client"
url = "{{baseUrl}}/v1/list-corpora"
headers = HTTP::Headers{
"customer-id" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/list-corpora"),
Headers =
{
{ "customer-id", "" },
},
Content = new StringContent("{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/list-corpora");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/list-corpora"
payload := strings.NewReader("{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/list-corpora HTTP/1.1
Customer-Id:
Content-Type: application/json
Host: example.com
Content-Length: 54
{
"filter": "",
"numResults": 0,
"pageKey": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/list-corpora")
.setHeader("customer-id", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/list-corpora"))
.header("customer-id", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/list-corpora")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/list-corpora")
.header("customer-id", "")
.header("content-type", "application/json")
.body("{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}")
.asString();
const data = JSON.stringify({
filter: '',
numResults: 0,
pageKey: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/list-corpora');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/list-corpora',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {filter: '', numResults: 0, pageKey: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/list-corpora';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"filter":"","numResults":0,"pageKey":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/list-corpora',
method: 'POST',
headers: {
'customer-id': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "filter": "",\n "numResults": 0,\n "pageKey": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/list-corpora")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/list-corpora',
headers: {
'customer-id': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({filter: '', numResults: 0, pageKey: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/list-corpora',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: {filter: '', numResults: 0, pageKey: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/list-corpora');
req.headers({
'customer-id': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
filter: '',
numResults: 0,
pageKey: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/list-corpora',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {filter: '', numResults: 0, pageKey: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/list-corpora';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"filter":"","numResults":0,"pageKey":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"filter": @"",
@"numResults": @0,
@"pageKey": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/list-corpora"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/list-corpora" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/list-corpora",
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([
'filter' => '',
'numResults' => 0,
'pageKey' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/list-corpora', [
'body' => '{
"filter": "",
"numResults": 0,
"pageKey": ""
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/list-corpora');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'filter' => '',
'numResults' => 0,
'pageKey' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'filter' => '',
'numResults' => 0,
'pageKey' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/list-corpora');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/list-corpora' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": "",
"numResults": 0,
"pageKey": ""
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/list-corpora' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": "",
"numResults": 0,
"pageKey": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"
headers = {
'customer-id': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/list-corpora", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/list-corpora"
payload = {
"filter": "",
"numResults": 0,
"pageKey": ""
}
headers = {
"customer-id": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/list-corpora"
payload <- "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/list-corpora")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/list-corpora') do |req|
req.headers['customer-id'] = ''
req.body = "{\n \"filter\": \"\",\n \"numResults\": 0,\n \"pageKey\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/list-corpora";
let payload = json!({
"filter": "",
"numResults": 0,
"pageKey": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/list-corpora \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--data '{
"filter": "",
"numResults": 0,
"pageKey": ""
}'
echo '{
"filter": "",
"numResults": 0,
"pageKey": ""
}' | \
http POST {{baseUrl}}/v1/list-corpora \
content-type:application/json \
customer-id:''
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'content-type: application/json' \
--body-data '{\n "filter": "",\n "numResults": 0,\n "pageKey": ""\n}' \
--output-document \
- {{baseUrl}}/v1/list-corpora
import Foundation
let headers = [
"customer-id": "",
"content-type": "application/json"
]
let parameters = [
"filter": "",
"numResults": 0,
"pageKey": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/list-corpora")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ResetCorpus
{{baseUrl}}/v1/reset-corpus
HEADERS
customer-id
BODY json
{
"corpusId": 0,
"customerId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/reset-corpus");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/reset-corpus" {:headers {:customer-id ""}
:content-type :json
:form-params {:corpusId 0
:customerId 0}})
require "http/client"
url = "{{baseUrl}}/v1/reset-corpus"
headers = HTTP::Headers{
"customer-id" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/reset-corpus"),
Headers =
{
{ "customer-id", "" },
},
Content = new StringContent("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/reset-corpus");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corpusId\": 0,\n \"customerId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/reset-corpus"
payload := strings.NewReader("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/reset-corpus HTTP/1.1
Customer-Id:
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"corpusId": 0,
"customerId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/reset-corpus")
.setHeader("customer-id", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/reset-corpus"))
.header("customer-id", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corpusId\": 0,\n \"customerId\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/reset-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/reset-corpus")
.header("customer-id", "")
.header("content-type", "application/json")
.body("{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
.asString();
const data = JSON.stringify({
corpusId: 0,
customerId: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/reset-corpus');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/reset-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {corpusId: 0, customerId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/reset-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpusId":0,"customerId":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/reset-corpus',
method: 'POST',
headers: {
'customer-id': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corpusId": 0,\n "customerId": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corpusId\": 0,\n \"customerId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/reset-corpus")
.post(body)
.addHeader("customer-id", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/reset-corpus',
headers: {
'customer-id': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({corpusId: 0, customerId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/reset-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: {corpusId: 0, customerId: 0},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/reset-corpus');
req.headers({
'customer-id': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
corpusId: 0,
customerId: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/reset-corpus',
headers: {'customer-id': '', 'content-type': 'application/json'},
data: {corpusId: 0, customerId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/reset-corpus';
const options = {
method: 'POST',
headers: {'customer-id': '', 'content-type': 'application/json'},
body: '{"corpusId":0,"customerId":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corpusId": @0,
@"customerId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/reset-corpus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/reset-corpus" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corpusId\": 0,\n \"customerId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/reset-corpus",
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([
'corpusId' => 0,
'customerId' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/reset-corpus', [
'body' => '{
"corpusId": 0,
"customerId": 0
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/reset-corpus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corpusId' => 0,
'customerId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corpusId' => 0,
'customerId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v1/reset-corpus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/reset-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": 0,
"customerId": 0
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/reset-corpus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": 0,
"customerId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
headers = {
'customer-id': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/reset-corpus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/reset-corpus"
payload = {
"corpusId": 0,
"customerId": 0
}
headers = {
"customer-id": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/reset-corpus"
payload <- "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/reset-corpus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/reset-corpus') do |req|
req.headers['customer-id'] = ''
req.body = "{\n \"corpusId\": 0,\n \"customerId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/reset-corpus";
let payload = json!({
"corpusId": 0,
"customerId": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/reset-corpus \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--data '{
"corpusId": 0,
"customerId": 0
}'
echo '{
"corpusId": 0,
"customerId": 0
}' | \
http POST {{baseUrl}}/v1/reset-corpus \
content-type:application/json \
customer-id:''
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'content-type: application/json' \
--body-data '{\n "corpusId": 0,\n "customerId": 0\n}' \
--output-document \
- {{baseUrl}}/v1/reset-corpus
import Foundation
let headers = [
"customer-id": "",
"content-type": "application/json"
]
let parameters = [
"corpusId": 0,
"customerId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/reset-corpus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Delete
{{baseUrl}}/v1/delete-doc
HEADERS
customer-id
x-api-key
{{apiKey}}
BODY json
{
"corpusId": "",
"customerId": "",
"documentId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/delete-doc");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/delete-doc" {:headers {:customer-id ""
:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:corpusId ""
:customerId ""
:documentId ""}})
require "http/client"
url = "{{baseUrl}}/v1/delete-doc"
headers = HTTP::Headers{
"customer-id" => ""
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/delete-doc"),
Headers =
{
{ "customer-id", "" },
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/delete-doc");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/delete-doc"
payload := strings.NewReader("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/delete-doc HTTP/1.1
Customer-Id:
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 60
{
"corpusId": "",
"customerId": "",
"documentId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/delete-doc")
.setHeader("customer-id", "")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/delete-doc"))
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/delete-doc")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/delete-doc")
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}")
.asString();
const data = JSON.stringify({
corpusId: '',
customerId: '',
documentId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/delete-doc');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-doc',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {corpusId: '', customerId: '', documentId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/delete-doc';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"corpusId":"","customerId":"","documentId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/delete-doc',
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corpusId": "",\n "customerId": "",\n "documentId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/delete-doc")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/delete-doc',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({corpusId: '', customerId: '', documentId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-doc',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: {corpusId: '', customerId: '', documentId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/delete-doc');
req.headers({
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
corpusId: '',
customerId: '',
documentId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/delete-doc',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {corpusId: '', customerId: '', documentId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/delete-doc';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"corpusId":"","customerId":"","documentId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corpusId": @"",
@"customerId": @"",
@"documentId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/delete-doc"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/delete-doc" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/delete-doc",
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([
'corpusId' => '',
'customerId' => '',
'documentId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: ",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/delete-doc', [
'body' => '{
"corpusId": "",
"customerId": "",
"documentId": ""
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/delete-doc');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corpusId' => '',
'customerId' => '',
'documentId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corpusId' => '',
'customerId' => '',
'documentId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/delete-doc');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/delete-doc' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": "",
"customerId": "",
"documentId": ""
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/delete-doc' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": "",
"customerId": "",
"documentId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"
headers = {
'customer-id': "",
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/delete-doc", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/delete-doc"
payload = {
"corpusId": "",
"customerId": "",
"documentId": ""
}
headers = {
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/delete-doc"
payload <- "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = '', 'x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/delete-doc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/delete-doc') do |req|
req.headers['customer-id'] = ''
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"documentId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/delete-doc";
let payload = json!({
"corpusId": "",
"customerId": "",
"documentId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/delete-doc \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"corpusId": "",
"customerId": "",
"documentId": ""
}'
echo '{
"corpusId": "",
"customerId": "",
"documentId": ""
}' | \
http POST {{baseUrl}}/v1/delete-doc \
content-type:application/json \
customer-id:'' \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "corpusId": "",\n "customerId": "",\n "documentId": ""\n}' \
--output-document \
- {{baseUrl}}/v1/delete-doc
import Foundation
let headers = [
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"corpusId": "",
"customerId": "",
"documentId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/delete-doc")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
FileUpload
{{baseUrl}}/v1/upload
HEADERS
x-api-key
{{apiKey}}
QUERY PARAMS
c
o
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/upload?c=&o=");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/upload" {:headers {:x-api-key "{{apiKey}}"}
:query-params {:c ""
:o ""}
:multipart [{:name "doc_metadata"
:content ""} {:name "file"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/v1/upload?c=&o="
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/upload?c=&o="),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "doc_metadata",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "file",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/upload?c=&o=");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/upload?c=&o="
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/upload?c=&o= HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 201
-----011000010111000001101001
Content-Disposition: form-data; name="doc_metadata"
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/upload?c=&o=")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/upload?c=&o="))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/upload?c=&o=")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/upload?c=&o=")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('doc_metadata', '');
data.append('file', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/upload?c=&o=');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('doc_metadata', '');
form.append('file', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/upload',
params: {c: '', o: ''},
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/upload?c=&o=';
const form = new FormData();
form.append('doc_metadata', '');
form.append('file', '');
const options = {method: 'POST', headers: {'x-api-key': '{{apiKey}}'}};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('doc_metadata', '');
form.append('file', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/upload?c=&o=',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}'
},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/v1/upload?c=&o=")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/upload?c=&o=',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write('-----011000010111000001101001\r\nContent-Disposition: form-data; name="doc_metadata"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/upload',
qs: {c: '', o: ''},
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
formData: {doc_metadata: '', file: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/upload');
req.query({
c: '',
o: ''
});
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/upload',
params: {c: '', o: ''},
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="doc_metadata"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('doc_metadata', '');
formData.append('file', '');
const url = '{{baseUrl}}/v1/upload?c=&o=';
const options = {method: 'POST', headers: {'x-api-key': '{{apiKey}}'}};
options.body = formData;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"doc_metadata", @"value": @"" },
@{ @"name": @"file", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/upload?c=&o="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/upload?c=&o=" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "multipart/form-data; boundary=---011000010111000001101001");
] in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/upload?c=&o=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/upload?c=&o=', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/upload');
$request->setMethod(HTTP_METH_POST);
$request->setQueryData([
'c' => '',
'o' => ''
]);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="doc_metadata"
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/v1/upload');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setQuery(new http\QueryString([
'c' => '',
'o' => ''
]));
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/upload?c=&o=' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="doc_metadata"
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/upload?c=&o=' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="doc_metadata"
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "multipart/form-data; boundary=---011000010111000001101001"
}
conn.request("POST", "/baseUrl/v1/upload?c=&o=", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/upload"
querystring = {"c":"","o":""}
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
}
response = requests.post(url, data=payload, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/upload"
queryString <- list(
c = "",
o = ""
)
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, query = queryString, add_headers('x-api-key' = '{{apiKey}}'), content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/upload?c=&o=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/v1/upload') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.params['c'] = ''
req.params['o'] = ''
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc_metadata\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/upload";
let querystring = [
("c", ""),
("o", ""),
];
let form = reqwest::multipart::Form::new()
.text("doc_metadata", "")
.text("file", "");
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.query(&querystring)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/v1/upload?c=&o=' \
--header 'content-type: multipart/form-data' \
--header 'x-api-key: {{apiKey}}' \
--form doc_metadata= \
--form file=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="doc_metadata"
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001--
' | \
http POST '{{baseUrl}}/v1/upload?c=&o=' \
content-type:'multipart/form-data; boundary=---011000010111000001101001' \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="doc_metadata"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- '{{baseUrl}}/v1/upload?c=&o='
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
[
"name": "doc_metadata",
"value": ""
],
[
"name": "file",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/upload?c=&o=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Index
{{baseUrl}}/v1/index
HEADERS
customer-id
x-api-key
{{apiKey}}
BODY json
{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/index");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/index" {:headers {:customer-id ""
:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:corpusId ""
:customerId ""
:document {:customDims [{:name ""
:value ""}]
:description ""
:documentId ""
:metadataJson ""
:section [{:customDims [{}]
:id 0
:metadataJson ""
:section []
:text ""
:title ""}]
:title ""}}})
require "http/client"
url = "{{baseUrl}}/v1/index"
headers = HTTP::Headers{
"customer-id" => ""
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/index"),
Headers =
{
{ "customer-id", "" },
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/index");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/index"
payload := strings.NewReader("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/index HTTP/1.1
Customer-Id:
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 425
{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/index")
.setHeader("customer-id", "")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/index"))
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/index")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/index")
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
corpusId: '',
customerId: '',
document: {
customDims: [
{
name: '',
value: ''
}
],
description: '',
documentId: '',
metadataJson: '',
section: [
{
customDims: [
{}
],
id: 0,
metadataJson: '',
section: [],
text: '',
title: ''
}
],
title: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/index');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/index',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
corpusId: '',
customerId: '',
document: {
customDims: [{name: '', value: ''}],
description: '',
documentId: '',
metadataJson: '',
section: [{customDims: [{}], id: 0, metadataJson: '', section: [], text: '', title: ''}],
title: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/index';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"corpusId":"","customerId":"","document":{"customDims":[{"name":"","value":""}],"description":"","documentId":"","metadataJson":"","section":[{"customDims":[{}],"id":0,"metadataJson":"","section":[],"text":"","title":""}],"title":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/index',
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corpusId": "",\n "customerId": "",\n "document": {\n "customDims": [\n {\n "name": "",\n "value": ""\n }\n ],\n "description": "",\n "documentId": "",\n "metadataJson": "",\n "section": [\n {\n "customDims": [\n {}\n ],\n "id": 0,\n "metadataJson": "",\n "section": [],\n "text": "",\n "title": ""\n }\n ],\n "title": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/index")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/index',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
corpusId: '',
customerId: '',
document: {
customDims: [{name: '', value: ''}],
description: '',
documentId: '',
metadataJson: '',
section: [{customDims: [{}], id: 0, metadataJson: '', section: [], text: '', title: ''}],
title: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/index',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: {
corpusId: '',
customerId: '',
document: {
customDims: [{name: '', value: ''}],
description: '',
documentId: '',
metadataJson: '',
section: [{customDims: [{}], id: 0, metadataJson: '', section: [], text: '', title: ''}],
title: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/index');
req.headers({
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
corpusId: '',
customerId: '',
document: {
customDims: [
{
name: '',
value: ''
}
],
description: '',
documentId: '',
metadataJson: '',
section: [
{
customDims: [
{}
],
id: 0,
metadataJson: '',
section: [],
text: '',
title: ''
}
],
title: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/index',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
corpusId: '',
customerId: '',
document: {
customDims: [{name: '', value: ''}],
description: '',
documentId: '',
metadataJson: '',
section: [{customDims: [{}], id: 0, metadataJson: '', section: [], text: '', title: ''}],
title: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/index';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"corpusId":"","customerId":"","document":{"customDims":[{"name":"","value":""}],"description":"","documentId":"","metadataJson":"","section":[{"customDims":[{}],"id":0,"metadataJson":"","section":[],"text":"","title":""}],"title":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corpusId": @"",
@"customerId": @"",
@"document": @{ @"customDims": @[ @{ @"name": @"", @"value": @"" } ], @"description": @"", @"documentId": @"", @"metadataJson": @"", @"section": @[ @{ @"customDims": @[ @{ } ], @"id": @0, @"metadataJson": @"", @"section": @[ ], @"text": @"", @"title": @"" } ], @"title": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/index"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/index" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/index",
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([
'corpusId' => '',
'customerId' => '',
'document' => [
'customDims' => [
[
'name' => '',
'value' => ''
]
],
'description' => '',
'documentId' => '',
'metadataJson' => '',
'section' => [
[
'customDims' => [
[
]
],
'id' => 0,
'metadataJson' => '',
'section' => [
],
'text' => '',
'title' => ''
]
],
'title' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: ",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/index', [
'body' => '{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/index');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corpusId' => '',
'customerId' => '',
'document' => [
'customDims' => [
[
'name' => '',
'value' => ''
]
],
'description' => '',
'documentId' => '',
'metadataJson' => '',
'section' => [
[
'customDims' => [
[
]
],
'id' => 0,
'metadataJson' => '',
'section' => [
],
'text' => '',
'title' => ''
]
],
'title' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corpusId' => '',
'customerId' => '',
'document' => [
'customDims' => [
[
'name' => '',
'value' => ''
]
],
'description' => '',
'documentId' => '',
'metadataJson' => '',
'section' => [
[
'customDims' => [
[
]
],
'id' => 0,
'metadataJson' => '',
'section' => [
],
'text' => '',
'title' => ''
]
],
'title' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/index');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/index' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/index' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"
headers = {
'customer-id': "",
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/index", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/index"
payload = {
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [{}],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}
headers = {
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/index"
payload <- "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = '', 'x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/index")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/index') do |req|
req.headers['customer-id'] = ''
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"corpusId\": \"\",\n \"customerId\": \"\",\n \"document\": {\n \"customDims\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"description\": \"\",\n \"documentId\": \"\",\n \"metadataJson\": \"\",\n \"section\": [\n {\n \"customDims\": [\n {}\n ],\n \"id\": 0,\n \"metadataJson\": \"\",\n \"section\": [],\n \"text\": \"\",\n \"title\": \"\"\n }\n ],\n \"title\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/index";
let payload = json!({
"corpusId": "",
"customerId": "",
"document": json!({
"customDims": (
json!({
"name": "",
"value": ""
})
),
"description": "",
"documentId": "",
"metadataJson": "",
"section": (
json!({
"customDims": (json!({})),
"id": 0,
"metadataJson": "",
"section": (),
"text": "",
"title": ""
})
),
"title": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/index \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}'
echo '{
"corpusId": "",
"customerId": "",
"document": {
"customDims": [
{
"name": "",
"value": ""
}
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
{
"customDims": [
{}
],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
}
],
"title": ""
}
}' | \
http POST {{baseUrl}}/v1/index \
content-type:application/json \
customer-id:'' \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "corpusId": "",\n "customerId": "",\n "document": {\n "customDims": [\n {\n "name": "",\n "value": ""\n }\n ],\n "description": "",\n "documentId": "",\n "metadataJson": "",\n "section": [\n {\n "customDims": [\n {}\n ],\n "id": 0,\n "metadataJson": "",\n "section": [],\n "text": "",\n "title": ""\n }\n ],\n "title": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v1/index
import Foundation
let headers = [
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"corpusId": "",
"customerId": "",
"document": [
"customDims": [
[
"name": "",
"value": ""
]
],
"description": "",
"documentId": "",
"metadataJson": "",
"section": [
[
"customDims": [[]],
"id": 0,
"metadataJson": "",
"section": [],
"text": "",
"title": ""
]
],
"title": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/index")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Query
{{baseUrl}}/v1/query
HEADERS
customer-id
x-api-key
{{apiKey}}
BODY json
{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/query");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/query" {:headers {:customer-id ""
:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:query [{:corpusKey [{:corpusId 0
:customerId 0
:dim [{:name ""
:weight ""}]
:metadataFilter ""
:semantics ""}]
:numResults 0
:query ""
:rerankingConfig {:rerankerId 0}
:start 0}]}})
require "http/client"
url = "{{baseUrl}}/v1/query"
headers = HTTP::Headers{
"customer-id" => ""
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/query"),
Headers =
{
{ "customer-id", "" },
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/query");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/query"
payload := strings.NewReader("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/query HTTP/1.1
Customer-Id:
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 424
{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/query")
.setHeader("customer-id", "")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/query"))
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/query")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/query")
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
.asString();
const data = JSON.stringify({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [
{
name: '',
weight: ''
}
],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {
rerankerId: 0
},
start: 0
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/query');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/query';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"query":[{"corpusKey":[{"corpusId":0,"customerId":0,"dim":[{"name":"","weight":""}],"metadataFilter":"","semantics":""}],"numResults":0,"query":"","rerankingConfig":{"rerankerId":0},"start":0}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/query',
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "query": [\n {\n "corpusKey": [\n {\n "corpusId": 0,\n "customerId": 0,\n "dim": [\n {\n "name": "",\n "weight": ""\n }\n ],\n "metadataFilter": "",\n "semantics": ""\n }\n ],\n "numResults": 0,\n "query": "",\n "rerankingConfig": {\n "rerankerId": 0\n },\n "start": 0\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/query")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/query');
req.headers({
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [
{
name: '',
weight: ''
}
],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {
rerankerId: 0
},
start: 0
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/query';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"query":[{"corpusKey":[{"corpusId":0,"customerId":0,"dim":[{"name":"","weight":""}],"metadataFilter":"","semantics":""}],"numResults":0,"query":"","rerankingConfig":{"rerankerId":0},"start":0}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"query": @[ @{ @"corpusKey": @[ @{ @"corpusId": @0, @"customerId": @0, @"dim": @[ @{ @"name": @"", @"weight": @"" } ], @"metadataFilter": @"", @"semantics": @"" } ], @"numResults": @0, @"query": @"", @"rerankingConfig": @{ @"rerankerId": @0 }, @"start": @0 } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/query"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/query" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/query",
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([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: ",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/query', [
'body' => '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/query');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
headers = {
'customer-id': "",
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/query"
payload = { "query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": { "rerankerId": 0 },
"start": 0
}
] }
headers = {
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/query"
payload <- "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = '', 'x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/query') do |req|
req.headers['customer-id'] = ''
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/query";
let payload = json!({"query": (
json!({
"corpusKey": (
json!({
"corpusId": 0,
"customerId": 0,
"dim": (
json!({
"name": "",
"weight": ""
})
),
"metadataFilter": "",
"semantics": ""
})
),
"numResults": 0,
"query": "",
"rerankingConfig": json!({"rerankerId": 0}),
"start": 0
})
)});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/query \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
echo '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}' | \
http POST {{baseUrl}}/v1/query \
content-type:application/json \
customer-id:'' \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "query": [\n {\n "corpusKey": [\n {\n "corpusId": 0,\n "customerId": 0,\n "dim": [\n {\n "name": "",\n "weight": ""\n }\n ],\n "metadataFilter": "",\n "semantics": ""\n }\n ],\n "numResults": 0,\n "query": "",\n "rerankingConfig": {\n "rerankerId": 0\n },\n "start": 0\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/v1/query
import Foundation
let headers = [
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["query": [
[
"corpusKey": [
[
"corpusId": 0,
"customerId": 0,
"dim": [
[
"name": "",
"weight": ""
]
],
"metadataFilter": "",
"semantics": ""
]
],
"numResults": 0,
"query": "",
"rerankingConfig": ["rerankerId": 0],
"start": 0
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/query")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
StreamQuery
{{baseUrl}}/v1/stream-query
HEADERS
customer-id
x-api-key
{{apiKey}}
BODY json
{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/stream-query");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "customer-id: ");
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/stream-query" {:headers {:customer-id ""
:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:query [{:corpusKey [{:corpusId 0
:customerId 0
:dim [{:name ""
:weight ""}]
:metadataFilter ""
:semantics ""}]
:numResults 0
:query ""
:rerankingConfig {:rerankerId 0}
:start 0}]}})
require "http/client"
url = "{{baseUrl}}/v1/stream-query"
headers = HTTP::Headers{
"customer-id" => ""
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/stream-query"),
Headers =
{
{ "customer-id", "" },
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/stream-query");
var request = new RestRequest("", Method.Post);
request.AddHeader("customer-id", "");
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/stream-query"
payload := strings.NewReader("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("customer-id", "")
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/stream-query HTTP/1.1
Customer-Id:
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 424
{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/stream-query")
.setHeader("customer-id", "")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/stream-query"))
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/stream-query")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/stream-query")
.header("customer-id", "")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
.asString();
const data = JSON.stringify({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [
{
name: '',
weight: ''
}
],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {
rerankerId: 0
},
start: 0
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/stream-query');
xhr.setRequestHeader('customer-id', '');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/stream-query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/stream-query';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"query":[{"corpusKey":[{"corpusId":0,"customerId":0,"dim":[{"name":"","weight":""}],"metadataFilter":"","semantics":""}],"numResults":0,"query":"","rerankingConfig":{"rerankerId":0},"start":0}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/stream-query',
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "query": [\n {\n "corpusKey": [\n {\n "corpusId": 0,\n "customerId": 0,\n "dim": [\n {\n "name": "",\n "weight": ""\n }\n ],\n "metadataFilter": "",\n "semantics": ""\n }\n ],\n "numResults": 0,\n "query": "",\n "rerankingConfig": {\n "rerankerId": 0\n },\n "start": 0\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/stream-query")
.post(body)
.addHeader("customer-id", "")
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/stream-query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/stream-query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/stream-query');
req.headers({
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [
{
name: '',
weight: ''
}
],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {
rerankerId: 0
},
start: 0
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/stream-query',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
data: {
query: [
{
corpusKey: [
{
corpusId: 0,
customerId: 0,
dim: [{name: '', weight: ''}],
metadataFilter: '',
semantics: ''
}
],
numResults: 0,
query: '',
rerankingConfig: {rerankerId: 0},
start: 0
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/stream-query';
const options = {
method: 'POST',
headers: {
'customer-id': '',
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
body: '{"query":[{"corpusKey":[{"corpusId":0,"customerId":0,"dim":[{"name":"","weight":""}],"metadataFilter":"","semantics":""}],"numResults":0,"query":"","rerankingConfig":{"rerankerId":0},"start":0}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"customer-id": @"",
@"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"query": @[ @{ @"corpusKey": @[ @{ @"corpusId": @0, @"customerId": @0, @"dim": @[ @{ @"name": @"", @"weight": @"" } ], @"metadataFilter": @"", @"semantics": @"" } ], @"numResults": @0, @"query": @"", @"rerankingConfig": @{ @"rerankerId": @0 }, @"start": @0 } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/stream-query"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/stream-query" in
let headers = Header.add_list (Header.init ()) [
("customer-id", "");
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/stream-query",
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([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"customer-id: ",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/stream-query', [
'body' => '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}',
'headers' => [
'content-type' => 'application/json',
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/stream-query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'query' => [
[
'corpusKey' => [
[
'corpusId' => 0,
'customerId' => 0,
'dim' => [
[
'name' => '',
'weight' => ''
]
],
'metadataFilter' => '',
'semantics' => ''
]
],
'numResults' => 0,
'query' => '',
'rerankingConfig' => [
'rerankerId' => 0
],
'start' => 0
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/stream-query');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'customer-id' => '',
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/stream-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
$headers=@{}
$headers.Add("customer-id", "")
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/stream-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
headers = {
'customer-id': "",
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/stream-query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/stream-query"
payload = { "query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": { "rerankerId": 0 },
"start": 0
}
] }
headers = {
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/stream-query"
payload <- "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('customer-id' = '', 'x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/stream-query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["customer-id"] = ''
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/stream-query') do |req|
req.headers['customer-id'] = ''
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"query\": [\n {\n \"corpusKey\": [\n {\n \"corpusId\": 0,\n \"customerId\": 0,\n \"dim\": [\n {\n \"name\": \"\",\n \"weight\": \"\"\n }\n ],\n \"metadataFilter\": \"\",\n \"semantics\": \"\"\n }\n ],\n \"numResults\": 0,\n \"query\": \"\",\n \"rerankingConfig\": {\n \"rerankerId\": 0\n },\n \"start\": 0\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/stream-query";
let payload = json!({"query": (
json!({
"corpusKey": (
json!({
"corpusId": 0,
"customerId": 0,
"dim": (
json!({
"name": "",
"weight": ""
})
),
"metadataFilter": "",
"semantics": ""
})
),
"numResults": 0,
"query": "",
"rerankingConfig": json!({"rerankerId": 0}),
"start": 0
})
)});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("customer-id", "".parse().unwrap());
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/stream-query \
--header 'content-type: application/json' \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}'
echo '{
"query": [
{
"corpusKey": [
{
"corpusId": 0,
"customerId": 0,
"dim": [
{
"name": "",
"weight": ""
}
],
"metadataFilter": "",
"semantics": ""
}
],
"numResults": 0,
"query": "",
"rerankingConfig": {
"rerankerId": 0
},
"start": 0
}
]
}' | \
http POST {{baseUrl}}/v1/stream-query \
content-type:application/json \
customer-id:'' \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'customer-id: ' \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "query": [\n {\n "corpusKey": [\n {\n "corpusId": 0,\n "customerId": 0,\n "dim": [\n {\n "name": "",\n "weight": ""\n }\n ],\n "metadataFilter": "",\n "semantics": ""\n }\n ],\n "numResults": 0,\n "query": "",\n "rerankingConfig": {\n "rerankerId": 0\n },\n "start": 0\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/v1/stream-query
import Foundation
let headers = [
"customer-id": "",
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["query": [
[
"corpusKey": [
[
"corpusId": 0,
"customerId": 0,
"dim": [
[
"name": "",
"weight": ""
]
],
"metadataFilter": "",
"semantics": ""
]
],
"numResults": 0,
"query": "",
"rerankingConfig": ["rerankerId": 0],
"start": 0
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/stream-query")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()