ROBOKOP Messenger
POST
Add support to message.
{{baseUrl}}/support
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/support");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/support" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/support"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/support"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/support");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/support"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/support HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/support")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/support"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/support")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/support")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/support');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/support',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/support';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/support',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/support")
.post(body)
.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/support',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/support',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/support');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/support',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/support';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/support"]
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}}/support" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/support",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/support', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/support');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/support');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/support' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/support' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/support", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/support"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/support"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/support")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/support') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/support";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/support \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/support \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/support
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/support")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Compute informativeness weights for edges.
{{baseUrl}}/weight_novelty
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/weight_novelty");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/weight_novelty" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/weight_novelty"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/weight_novelty"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/weight_novelty");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/weight_novelty"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/weight_novelty HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/weight_novelty")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/weight_novelty"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/weight_novelty")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/weight_novelty")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/weight_novelty');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/weight_novelty',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/weight_novelty';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/weight_novelty',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/weight_novelty")
.post(body)
.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/weight_novelty',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/weight_novelty',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/weight_novelty');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/weight_novelty',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/weight_novelty';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/weight_novelty"]
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}}/weight_novelty" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/weight_novelty",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/weight_novelty', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/weight_novelty');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/weight_novelty');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/weight_novelty' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/weight_novelty' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/weight_novelty", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/weight_novelty"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/weight_novelty"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/weight_novelty")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/weight_novelty') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/weight_novelty";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/weight_novelty \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/weight_novelty \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/weight_novelty
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/weight_novelty")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Copy relevant portions of remote knowledge graph into local knowledge graph.
{{baseUrl}}/yank
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/yank");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/yank" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/yank"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/yank"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/yank");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/yank"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/yank HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/yank")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/yank"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/yank")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/yank")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/yank');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/yank',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/yank';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/yank',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/yank")
.post(body)
.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/yank',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/yank',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/yank');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/yank',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/yank';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/yank"]
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}}/yank" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/yank",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/yank', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/yank');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/yank');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/yank' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/yank' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/yank", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/yank"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/yank"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/yank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/yank') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/yank";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/yank \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/yank \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/yank
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/yank")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Fetch answers to question.
{{baseUrl}}/answer
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/answer");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/answer" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {:max_connectivity 0}}})
require "http/client"
url = "{{baseUrl}}/answer"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\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}}/answer"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\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}}/answer");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/answer"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/answer HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 654
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/answer")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/answer"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/answer")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/answer")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {
max_connectivity: 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}}/answer');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/answer',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_connectivity: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/answer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{"max_connectivity":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}}/answer',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {\n "max_connectivity": 0\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/answer")
.post(body)
.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/answer',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_connectivity: 0}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/answer',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_connectivity: 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}}/answer');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {
max_connectivity: 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}}/answer',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_connectivity: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/answer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{"max_connectivity":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ @"max_connectivity": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/answer"]
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}}/answer" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/answer",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_connectivity' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/answer', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/answer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_connectivity' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_connectivity' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/answer');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/answer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/answer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/answer", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/answer"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": { "max_connectivity": 0 }
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/answer"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/answer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\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/answer') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_connectivity\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/answer";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({"max_connectivity": 0})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/answer \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_connectivity": 0
}
}' | \
http POST {{baseUrl}}/answer \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {\n "max_connectivity": 0\n }\n}' \
--output-document \
- {{baseUrl}}/answer
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": ["max_connectivity": 0]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/answer")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Minify message.
{{baseUrl}}/minify
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/minify");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/minify" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/minify"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/minify"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/minify");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/minify"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/minify HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/minify")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/minify"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/minify")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/minify")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/minify');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/minify',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/minify';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/minify',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/minify")
.post(body)
.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/minify',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/minify',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/minify');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/minify',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/minify';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/minify"]
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}}/minify" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/minify",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/minify', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/minify');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/minify');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/minify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/minify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/minify", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/minify"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/minify"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/minify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/minify') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/minify";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/minify \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/minify \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/minify
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/minify")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Normalize.
{{baseUrl}}/normalize
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/normalize");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/normalize" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/normalize"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/normalize"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/normalize");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/normalize"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/normalize HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/normalize")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/normalize"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/normalize")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/normalize")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/normalize');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/normalize',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/normalize';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/normalize',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/normalize")
.post(body)
.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/normalize',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/normalize',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/normalize');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/normalize',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/normalize';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/normalize"]
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}}/normalize" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/normalize",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/normalize', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/normalize');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/normalize');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/normalize' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/normalize' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/normalize", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/normalize"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/normalize"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/normalize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/normalize') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/normalize";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/normalize \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/normalize \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/normalize
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/normalize")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Prescreen subgraphs.
{{baseUrl}}/screen
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/screen");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/screen" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {:max_results 0}}})
require "http/client"
url = "{{baseUrl}}/screen"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\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}}/screen"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\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}}/screen");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/screen"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/screen HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 649
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/screen")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/screen"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/screen")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/screen")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {
max_results: 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}}/screen');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/screen',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_results: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/screen';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{"max_results":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}}/screen',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {\n "max_results": 0\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/screen")
.post(body)
.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/screen',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_results: 0}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/screen',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_results: 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}}/screen');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {
max_results: 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}}/screen',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {max_results: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/screen';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{"max_results":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ @"max_results": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/screen"]
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}}/screen" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/screen",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_results' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/screen', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/screen');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_results' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
'max_results' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/screen');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/screen' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/screen' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/screen", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/screen"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": { "max_results": 0 }
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/screen"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/screen")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\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/screen') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {\n \"max_results\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/screen";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({"max_results": 0})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/screen \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {
"max_results": 0
}
}' | \
http POST {{baseUrl}}/screen \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {\n "max_results": 0\n }\n}' \
--output-document \
- {{baseUrl}}/screen
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": ["max_results": 0]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/screen")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Score answers.
{{baseUrl}}/score
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/score");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/score" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/score"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/score"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/score");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/score"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/score HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/score")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/score"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/score")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/score")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/score');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/score',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/score';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/score',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/score")
.post(body)
.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/score',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/score',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/score');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/score',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/score';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/score"]
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}}/score" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/score",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/score', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/score');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/score');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/score' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/score' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/score", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/score"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/score"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/score")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/score') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/score";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/score \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/score \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/score
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/score")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}
POST
Weight kgraph edges based on metadata.
{{baseUrl}}/weight_correctness
BODY json
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/weight_correctness");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/weight_correctness" {:content-type :json
:form-params {:message {:knowledge_graph {}
:query_graph {:edges [{:id ""
:source_id ""
:target_id ""
:type ""}]
:nodes [{:curie ""
:id ""
:type ""}]}
:results [{:edge_bindings [{:kg_id ""
:qg_id ""}]
:node_bindings [{:kg_id ""
:qg_id ""}]
:score ""}]}
:options {}}})
require "http/client"
url = "{{baseUrl}}/weight_correctness"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/weight_correctness"),
Content = new StringContent("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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}}/weight_correctness");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/weight_correctness"
payload := strings.NewReader("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/weight_correctness HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 625
{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/weight_correctness")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/weight_correctness"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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 \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/weight_correctness")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/weight_correctness")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
.asString();
const data = JSON.stringify({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/weight_correctness');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/weight_correctness',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/weight_correctness';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
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}}/weight_correctness',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/weight_correctness")
.post(body)
.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/weight_correctness',
headers: {
'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({
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/weight_correctness',
headers: {'content-type': 'application/json'},
body: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
},
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}}/weight_correctness');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
knowledge_graph: {},
query_graph: {
edges: [
{
id: '',
source_id: '',
target_id: '',
type: ''
}
],
nodes: [
{
curie: '',
id: '',
type: ''
}
]
},
results: [
{
edge_bindings: [
{
kg_id: '',
qg_id: ''
}
],
node_bindings: [
{
kg_id: '',
qg_id: ''
}
],
score: ''
}
]
},
options: {}
});
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}}/weight_correctness',
headers: {'content-type': 'application/json'},
data: {
message: {
knowledge_graph: {},
query_graph: {
edges: [{id: '', source_id: '', target_id: '', type: ''}],
nodes: [{curie: '', id: '', type: ''}]
},
results: [
{
edge_bindings: [{kg_id: '', qg_id: ''}],
node_bindings: [{kg_id: '', qg_id: ''}],
score: ''
}
]
},
options: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/weight_correctness';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"knowledge_graph":{},"query_graph":{"edges":[{"id":"","source_id":"","target_id":"","type":""}],"nodes":[{"curie":"","id":"","type":""}]},"results":[{"edge_bindings":[{"kg_id":"","qg_id":""}],"node_bindings":[{"kg_id":"","qg_id":""}],"score":""}]},"options":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"knowledge_graph": @{ }, @"query_graph": @{ @"edges": @[ @{ @"id": @"", @"source_id": @"", @"target_id": @"", @"type": @"" } ], @"nodes": @[ @{ @"curie": @"", @"id": @"", @"type": @"" } ] }, @"results": @[ @{ @"edge_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"node_bindings": @[ @{ @"kg_id": @"", @"qg_id": @"" } ], @"score": @"" } ] },
@"options": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/weight_correctness"]
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}}/weight_correctness" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/weight_correctness",
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([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/weight_correctness', [
'body' => '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/weight_correctness');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'knowledge_graph' => [
],
'query_graph' => [
'edges' => [
[
'id' => '',
'source_id' => '',
'target_id' => '',
'type' => ''
]
],
'nodes' => [
[
'curie' => '',
'id' => '',
'type' => ''
]
]
],
'results' => [
[
'edge_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'node_bindings' => [
[
'kg_id' => '',
'qg_id' => ''
]
],
'score' => ''
]
]
],
'options' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/weight_correctness');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/weight_correctness' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/weight_correctness' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/weight_correctness", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/weight_correctness"
payload = {
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/weight_correctness"
payload <- "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/weight_correctness")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\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/weight_correctness') do |req|
req.body = "{\n \"message\": {\n \"knowledge_graph\": {},\n \"query_graph\": {\n \"edges\": [\n {\n \"id\": \"\",\n \"source_id\": \"\",\n \"target_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"nodes\": [\n {\n \"curie\": \"\",\n \"id\": \"\",\n \"type\": \"\"\n }\n ]\n },\n \"results\": [\n {\n \"edge_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"node_bindings\": [\n {\n \"kg_id\": \"\",\n \"qg_id\": \"\"\n }\n ],\n \"score\": \"\"\n }\n ]\n },\n \"options\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/weight_correctness";
let payload = json!({
"message": json!({
"knowledge_graph": json!({}),
"query_graph": json!({
"edges": (
json!({
"id": "",
"source_id": "",
"target_id": "",
"type": ""
})
),
"nodes": (
json!({
"curie": "",
"id": "",
"type": ""
})
)
}),
"results": (
json!({
"edge_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"node_bindings": (
json!({
"kg_id": "",
"qg_id": ""
})
),
"score": ""
})
)
}),
"options": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/weight_correctness \
--header 'content-type: application/json' \
--data '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}'
echo '{
"message": {
"knowledge_graph": {},
"query_graph": {
"edges": [
{
"id": "",
"source_id": "",
"target_id": "",
"type": ""
}
],
"nodes": [
{
"curie": "",
"id": "",
"type": ""
}
]
},
"results": [
{
"edge_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"node_bindings": [
{
"kg_id": "",
"qg_id": ""
}
],
"score": ""
}
]
},
"options": {}
}' | \
http POST {{baseUrl}}/weight_correctness \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "knowledge_graph": {},\n "query_graph": {\n "edges": [\n {\n "id": "",\n "source_id": "",\n "target_id": "",\n "type": ""\n }\n ],\n "nodes": [\n {\n "curie": "",\n "id": "",\n "type": ""\n }\n ]\n },\n "results": [\n {\n "edge_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "node_bindings": [\n {\n "kg_id": "",\n "qg_id": ""\n }\n ],\n "score": ""\n }\n ]\n },\n "options": {}\n}' \
--output-document \
- {{baseUrl}}/weight_correctness
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"knowledge_graph": [],
"query_graph": [
"edges": [
[
"id": "",
"source_id": "",
"target_id": "",
"type": ""
]
],
"nodes": [
[
"curie": "",
"id": "",
"type": ""
]
]
],
"results": [
[
"edge_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"node_bindings": [
[
"kg_id": "",
"qg_id": ""
]
],
"score": ""
]
]
],
"options": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/weight_correctness")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"knowledge_graph": {
"edges": [],
"nodes": [
{
"id": "MONDO:0005737"
}
]
},
"query_graph": {
"edges": [],
"nodes": [
{
"curie": "MONDO:0005737",
"id": "n00"
}
]
},
"results": [
{
"n00": [
"MONDO:0005737"
]
}
]
}