query ($id: ID!) {
document(id: $id) {
id
data
}
}
curl 'https://subdomain.kualibuild.com/app/api/v0/graphql' -H 'Content-Type: application/json' -H 'Authorization: Bearer apikey' --data-binary '{"query":"query ($id: ID!) { document(id: $id) { id data }}","variables":{"id":"63eff2b9b303222b5ef823d2"}}' --compressed
import fetch from 'node-fetch'
const subdomain = 'subdomain'
const apikey = 'apikey'
const query = `query ($id: ID!) {
document(id: $id) {
id
data
}
}`
const variables = {"id":"63eff2b9b303222b5ef823d2"}
fetch(`https://${subdomain}.kualibuild.com/app/api/v0/graphql`, {
method:'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apikey}`
},
body: JSON.stringify({query, variables})
})
.then(res => res.text())
.then(data => console.log(data))
.catch(err => console.log(err))
<?php
$subdomain = "subdomain";
$apikey = "apikey";
$url = "https://{$subdomain}.kualibuild.com/app/api/v0/graphql";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Content-Type: application/json",
"Authorization: Bearer {$apikey}",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data= '{"query":"query ($id: ID!) { document(id: $id) { id data }}","variables":{"id":"63eff2b9b303222b5ef823d2"}}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
require 'net/http'
require 'uri'
require 'json'
subdomain = "subdomain"
apikey = "apikey"
uri = URI.parse("https://#{subdomain}.kualibuild.com/app/api/v0/graphql")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request["Authorization"] = "Bearer #{apikey}"
request.body = JSON.dump({
"query" => "query ($id: ID!) {
document(id: $id) {
id
data
}
}",
"variables" => {"id":"63eff2b9b303222b5ef823d2"}
})
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
puts response.code
puts response.body
import java.io.*;
import java.util.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
public class exampleCreate {
public static void main(String[] args) throws IOException {
String subdomain = "subdomain";
String apikey = "apikey";
URL url = new URL("https://" + subdomain + ".kualibuild.com/app/api/v0/graphql");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
http.setRequestMethod("POST");
http.setDoOutput(true);
http.setRequestProperty("Content-Type", "application/json");
http.setRequestProperty("Origin", "https://" + subdomain + ".kualibuild.com");
http.setRequestProperty("Authorization", "Bearer " + apikey);
String data = "{\"query\":\"query ($id: ID!) { document(id: $id) { id data }}\",\"variables\":{\"id\":\"63eff2b9b303222b5ef823d2\"}}";
byte[] out = data.getBytes(Charset.forName("UTF-8"));
OutputStream stream = http.getOutputStream();
stream.write(out);
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print in String
System.out.println(response.toString());
http.disconnect();
}
}