GET Get fact of the day for the given category.
{{baseUrl}}/fact/fod
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/fod");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/fod" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/fod"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/fod"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/fod");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/fod"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/fod HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/fod")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/fod"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/fod")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/fod")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/fod');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/fod';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/fod',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/fod")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/fod',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/fod');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/fod';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/fod"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/fod" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/fod",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/fod', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/fod');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/fod');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/fod' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/fod' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/fod", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/fod"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/fod"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/fod")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/fod') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/fod";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/fod \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/fod \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/fod
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/fod")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 1
  },
  "contents": {
    "facts": [
      {
        "description": "Science Fact of the day",
        "language": "en",
        "background": "",
        "category": "Science",
        "date": "2019-10-09",
        "fact": "In 1932 it was discovered that astronomical objects emit radio waves, and a system has been developed that makes it possible to create pictures from the radio waves. Astronomers use radio telescopes to study the radio waves being emitted from planets, dust, stars, gas clouds, comets, and other galaxies.",
        "subcategory": "Radio Waves"
      }
    ],
    "copyright": "2019-22 https://fungenerators.com"
  }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}                                        
GET Get the list of supported fact of the day categories.
{{baseUrl}}/fact/fod/categories
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/fod/categories");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/fod/categories" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/fod/categories"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/fod/categories"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/fod/categories");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/fod/categories"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/fod/categories HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/fod/categories")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/fod/categories"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/fod/categories")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/fod/categories")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/fod/categories');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/fod/categories';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/fod/categories',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/fod/categories")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/fod/categories',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/fod/categories');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/fod/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/fod/categories';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/fod/categories"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/fod/categories" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/fod/categories",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/fod/categories', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/fod/categories');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/fod/categories');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/fod/categories' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/fod/categories' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/fod/categories", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/fod/categories"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/fod/categories"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/fod/categories")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/fod/categories') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/fod/categories";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/fod/categories \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/fod/categories \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/fod/categories
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/fod/categories")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 2
  },
  "contents": {
    "categories": [
      {
        "name": "random",
        "description": "Random Fact of the day",
        "language": "en",
        "background": ""
      },
      {
        "name": "science",
        "description": "Science Fact of the day",
        "language": "en",
        "background": ""
      }
    ],
    "copyright": "2019-22 https://fungenerators.com"
  }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Get a random fact about a number
{{baseUrl}}/fact/numbers
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
QUERY PARAMS

number
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/numbers?number=");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/numbers" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}
                                                        :query-params {:number ""}})
require "http/client"

url = "{{baseUrl}}/fact/numbers?number="
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/numbers?number="),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/numbers?number=");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/numbers?number="

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/numbers?number= HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/numbers?number=")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/numbers?number="))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/numbers?number=")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/numbers?number=")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/numbers?number=');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/numbers',
  params: {number: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/numbers?number=';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/numbers?number=',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/numbers?number=")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/numbers?number=',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/numbers',
  qs: {number: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/numbers');

req.query({
  number: ''
});

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/numbers',
  params: {number: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/numbers?number=';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/numbers?number="]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/numbers?number=" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/numbers?number=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/numbers?number=', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/numbers');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData([
  'number' => ''
]);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/numbers');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
  'number' => ''
]));

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/numbers?number=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/numbers?number=' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/numbers?number=", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/numbers"

querystring = {"number":""}

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/numbers"

queryString <- list(number = "")

response <- VERB("GET", url, query = queryString, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/numbers?number=")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/numbers') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
  req.params['number'] = ''
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/numbers";

    let querystring = [
        ("number", ""),
    ];

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .query(&querystring)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url '{{baseUrl}}/fact/numbers?number=' \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET '{{baseUrl}}/fact/numbers?number=' \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - '{{baseUrl}}/fact/numbers?number='
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/numbers?number=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 1
  },
  "copyright": "2019-22 https://fungenerators.com",
  "contents": {
    "number": 11,
    "fact": "11 is the largest known multiplicative persistence."
  }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}                                        
GET Returns a random ( famous- relatively famous ) historic event on a given day and month
{{baseUrl}}/fact/onthisday/event
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/onthisday/event");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/onthisday/event" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/onthisday/event"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/onthisday/event"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/onthisday/event");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/onthisday/event"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/onthisday/event HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/onthisday/event")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/onthisday/event"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/event")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/onthisday/event")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/onthisday/event');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/event',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/onthisday/event';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/onthisday/event',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/event")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/onthisday/event',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/event',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/onthisday/event');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/event',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/onthisday/event';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/onthisday/event"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/onthisday/event" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/onthisday/event",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/onthisday/event', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/onthisday/event');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/onthisday/event');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/onthisday/event' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/onthisday/event' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/onthisday/event", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/onthisday/event"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/onthisday/event"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/onthisday/event")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/onthisday/event') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/onthisday/event";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/onthisday/event \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/onthisday/event \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/onthisday/event
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/onthisday/event")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 1
  },
  "contents": {
    "id": "KVlPpVL119DtLFtphgOxqQeF",
    "day": "26",
    "month": "8",
    "year": "1883",
    "date": "1883-8-26",
    "event_type": "event",
    "event": "The Indonesian island of Krakatoa erupts in the largest explosion recorded in history, heard 2,200 miles away in Madagascar. The resulting destruction sends volcanic ash up 50 miles into the atmosphere and kills almost 36,000 people–both on the island itself and from the resulting 131-foot tidal waves that obliterate 163 villages on the shores of nearby Java and Sumatra."
  }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Returns a random ( famous- relatively famous ) person born on a given day and month
{{baseUrl}}/fact/onthisday/born
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/onthisday/born");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/onthisday/born" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/onthisday/born"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/onthisday/born"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/onthisday/born");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/onthisday/born"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/onthisday/born HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/onthisday/born")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/onthisday/born"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/born")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/onthisday/born")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/onthisday/born');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/born',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/onthisday/born';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/onthisday/born',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/born")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/onthisday/born',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/born',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/onthisday/born');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/born',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/onthisday/born';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/onthisday/born"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/onthisday/born" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/onthisday/born",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/onthisday/born', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/onthisday/born');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/onthisday/born');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/onthisday/born' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/onthisday/born' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/onthisday/born", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/onthisday/born"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/onthisday/born"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/onthisday/born")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/onthisday/born') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/onthisday/born";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/onthisday/born \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/onthisday/born \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/onthisday/born
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/onthisday/born")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 1
  },
  "contents": [
    {
      "name": "Edward R. Bradley",
      "occupation": "American businessman and horse owner (1st to own 4 Kentucky Derby winners)",
      "notable": null,
      "born": "1859-12-12",
      "died": "1946-08-15"
    }
  ]
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Returns a random ( famous- relatively famous ) person died on a given day and month
{{baseUrl}}/fact/onthisday/died
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/onthisday/died");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/onthisday/died" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/onthisday/died"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/onthisday/died"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/onthisday/died");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/onthisday/died"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/onthisday/died HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/onthisday/died")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/onthisday/died"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/died")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/onthisday/died")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/onthisday/died');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/died',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/onthisday/died';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/onthisday/died',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/onthisday/died")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/onthisday/died',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/died',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/onthisday/died');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/onthisday/died',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/onthisday/died';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/onthisday/died"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/onthisday/died" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/onthisday/died",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/onthisday/died', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/onthisday/died');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/onthisday/died');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/onthisday/died' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/onthisday/died' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/onthisday/died", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/onthisday/died"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/onthisday/died"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/onthisday/died")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/onthisday/died') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/onthisday/died";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/onthisday/died \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/onthisday/died \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/onthisday/died
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/onthisday/died")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success": {
    "total": 1
  },
  "contents": [
    {
      "name": "Edward R. Bradley",
      "occupation": "American businessman and horse owner (1st to own 4 Kentucky Derby winners)",
      "notable": null,
      "born": "1859-12-12",
      "died": "1946-08-15"
    }
  ]
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
PUT Add a Fact entry to the database (private collection).
{{baseUrl}}/fact
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
QUERY PARAMS

fact
category
subcategory
tags
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact?fact=&category=&subcategory=&tags=");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/put "{{baseUrl}}/fact" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}
                                                :query-params {:fact ""
                                                               :category ""
                                                               :subcategory ""
                                                               :tags ""}})
require "http/client"

url = "{{baseUrl}}/fact?fact=&category=&subcategory=&tags="
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.put url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Put,
    RequestUri = new Uri("{{baseUrl}}/fact?fact=&category=&subcategory=&tags="),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact?fact=&category=&subcategory=&tags=");
var request = new RestRequest("", Method.Put);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact?fact=&category=&subcategory=&tags="

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
PUT /baseUrl/fact?fact=&category=&subcategory=&tags= HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact?fact=&category=&subcategory=&tags="))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("PUT", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")
  .put(null)
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('PUT', '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'PUT',
  url: '{{baseUrl}}/fact',
  params: {fact: '', category: '', subcategory: '', tags: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=';
const options = {method: 'PUT', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact?fact=&category=&subcategory=&tags=',
  method: 'PUT',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")
  .put(null)
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'PUT',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact?fact=&category=&subcategory=&tags=',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'PUT',
  url: '{{baseUrl}}/fact',
  qs: {fact: '', category: '', subcategory: '', tags: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('PUT', '{{baseUrl}}/fact');

req.query({
  fact: '',
  category: '',
  subcategory: '',
  tags: ''
});

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'PUT',
  url: '{{baseUrl}}/fact',
  params: {fact: '', category: '', subcategory: '', tags: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=';
const options = {method: 'PUT', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact?fact=&category=&subcategory=&tags="]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];

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}}/fact?fact=&category=&subcategory=&tags=" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `PUT uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact?fact=&category=&subcategory=&tags=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('PUT', '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact');
$request->setMethod(HTTP_METH_PUT);

$request->setQueryData([
  'fact' => '',
  'category' => '',
  'subcategory' => '',
  'tags' => ''
]);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact');
$request->setRequestMethod('PUT');
$request->setQuery(new http\QueryString([
  'fact' => '',
  'category' => '',
  'subcategory' => '',
  'tags' => ''
]));

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=' -Method PUT -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=' -Method PUT -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("PUT", "/baseUrl/fact?fact=&category=&subcategory=&tags=", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact"

querystring = {"fact":"","category":"","subcategory":"","tags":""}

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.put(url, headers=headers, params=querystring)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact"

queryString <- list(
  fact = "",
  category = "",
  subcategory = "",
  tags = ""
)

response <- VERB("PUT", url, query = queryString, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.put('/baseUrl/fact') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
  req.params['fact'] = ''
  req.params['category'] = ''
  req.params['subcategory'] = ''
  req.params['tags'] = ''
end

puts response.status
puts response.body
use std::str::FromStr;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact";

    let querystring = [
        ("fact", ""),
        ("category", ""),
        ("subcategory", ""),
        ("tags", ""),
    ];

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
        .query(&querystring)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request PUT \
  --url '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=' \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http PUT '{{baseUrl}}/fact?fact=&category=&subcategory=&tags=' \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method PUT \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - '{{baseUrl}}/fact?fact=&category=&subcategory=&tags='
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact?fact=&category=&subcategory=&tags=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

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

{
    "success": {
        "total": 1
    },
    "contents": {
        "id": "62D6iKM9GSlJxK5nrMf9XwrE"
    }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
DELETE Delete a Fact entry identified by the id.
{{baseUrl}}/fact
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
QUERY PARAMS

id
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact?id=");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/delete "{{baseUrl}}/fact" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}
                                                   :query-params {:id ""}})
require "http/client"

url = "{{baseUrl}}/fact?id="
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Delete,
    RequestUri = new Uri("{{baseUrl}}/fact?id="),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact?id=");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact?id="

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
DELETE /baseUrl/fact?id= HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/fact?id=")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact?id="))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("DELETE", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact?id=")
  .delete(null)
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/fact?id=")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('DELETE', '{{baseUrl}}/fact?id=');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'DELETE',
  url: '{{baseUrl}}/fact',
  params: {id: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact?id=';
const options = {method: 'DELETE', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact?id=',
  method: 'DELETE',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact?id=")
  .delete(null)
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'DELETE',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact?id=',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'DELETE',
  url: '{{baseUrl}}/fact',
  qs: {id: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('DELETE', '{{baseUrl}}/fact');

req.query({
  id: ''
});

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'DELETE',
  url: '{{baseUrl}}/fact',
  params: {id: ''},
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact?id=';
const options = {method: 'DELETE', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact?id="]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];

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}}/fact?id=" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact?id=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('DELETE', '{{baseUrl}}/fact?id=', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact');
$request->setMethod(HTTP_METH_DELETE);

$request->setQueryData([
  'id' => ''
]);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact');
$request->setRequestMethod('DELETE');
$request->setQuery(new http\QueryString([
  'id' => ''
]));

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact?id=' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact?id=' -Method DELETE -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("DELETE", "/baseUrl/fact?id=", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact"

querystring = {"id":""}

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.delete(url, headers=headers, params=querystring)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact"

queryString <- list(id = "")

response <- VERB("DELETE", url, query = queryString, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact?id=")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.delete('/baseUrl/fact') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
  req.params['id'] = ''
end

puts response.status
puts response.body
use std::str::FromStr;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact";

    let querystring = [
        ("id", ""),
    ];

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
        .query(&querystring)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request DELETE \
  --url '{{baseUrl}}/fact?id=' \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http DELETE '{{baseUrl}}/fact?id=' \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method DELETE \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - '{{baseUrl}}/fact?id='
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact?id=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

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

{
    "success": {
        "total": 1
    },
    "contents": {
        "mesg": "Fact 62D6iKM9GSlJxK5nrMf9XwrE is deleted"
    }
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Get a Fact belonging to the id.
{{baseUrl}}/fact
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success":{"total":1},
  "contents":{
    "fact":"There are more than 1,100 known tributaries flowing into the Amazon River. Tributaries are sources of water such as a small river, stream  or other water flow that reaches the river.",
    "id":"LCN5KlSn6BMpcm3ruXhfGweF",
    "category":null,
    "subcategory":null
      
  }
  
    
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Get a random Fact for a given category(optional) and subcategory(optional).
{{baseUrl}}/fact/random
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/random");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/random" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/random"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/random"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/random");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/random"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/random HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/random")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/random"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/random")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/random")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/random');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/random',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/random';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/random',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/random")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/random',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/random',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/random');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/random',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/random';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/random"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/random" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/random",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/random', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/random');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/random');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/random' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/random' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/random", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/random"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/random"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/random")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/random') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/random";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/random \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/random \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/random
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/random")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success":{"total":1},
  "contents":{
    "fact":"There are more than 1,100 known tributaries flowing into the Amazon River. Tributaries are sources of water such as a small river, stream  or other water flow that reaches the river.",
    "id":"LCN5KlSn6BMpcm3ruXhfGweF",
    "category":null,
    "subcategory":null
      
  }
  
    
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}                    
GET Get a random Fact.
{{baseUrl}}/fact/categories
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/categories");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/categories" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/categories"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/categories"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/categories");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/categories"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/categories HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/categories")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/categories"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/categories")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/categories")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/categories');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/categories';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/categories',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/categories")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/categories',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/categories');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/categories',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/categories';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/categories"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/categories" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/categories",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/categories', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/categories');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/categories');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/categories' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/categories' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/categories", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/categories"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/categories"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/categories")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/categories') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/categories";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/categories \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/categories \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/categories
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/categories")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
    "success": {
        "total": 1
    },
    "contents": [
        {
            "id": "VO_foToeaTPvaDn_utYcOweF",
            "question": "What is the unit of currency in the United States of America",
            "category": "usa",
            "category_name": "USA",
            "answer": [
                "Dollar"
            ]
        }
    ]
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}
GET Search for random Fact which has the text in the query, for a given category(optional) and subcategory(optional).
{{baseUrl}}/fact/search
HEADERS

X-Fungenerators-Api-Secret
{{apiKey}}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/fact/search");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-fungenerators-api-secret: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/fact/search" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"

url = "{{baseUrl}}/fact/search"
headers = HTTP::Headers{
  "x-fungenerators-api-secret" => "{{apiKey}}"
}

response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/fact/search"),
    Headers =
    {
        { "x-fungenerators-api-secret", "{{apiKey}}" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/fact/search");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-fungenerators-api-secret", "{{apiKey}}");
var response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "{{baseUrl}}/fact/search"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-fungenerators-api-secret", "{{apiKey}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
GET /baseUrl/fact/search HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/fact/search")
  .setHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/fact/search"))
    .header("x-fungenerators-api-secret", "{{apiKey}}")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/fact/search")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/fact/search")
  .header("x-fungenerators-api-secret", "{{apiKey}}")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/fact/search');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/search',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/fact/search';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

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}}/fact/search',
  method: 'GET',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/fact/search")
  .get()
  .addHeader("x-fungenerators-api-secret", "{{apiKey}}")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/fact/search',
  headers: {
    'x-fungenerators-api-secret': '{{apiKey}}'
  }
};

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.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/search',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/fact/search');

req.headers({
  'x-fungenerators-api-secret': '{{apiKey}}'
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/fact/search',
  headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/fact/search';
const options = {method: 'GET', headers: {'x-fungenerators-api-secret': '{{apiKey}}'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
#import 

NSDictionary *headers = @{ @"x-fungenerators-api-secret": @"{{apiKey}}" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/fact/search"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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}}/fact/search" in
let headers = Header.add (Header.init ()) "x-fungenerators-api-secret" "{{apiKey}}" in

Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/fact/search",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-fungenerators-api-secret: {{apiKey}}"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/fact/search', [
  'headers' => [
    'x-fungenerators-api-secret' => '{{apiKey}}',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/fact/search');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/fact/search');
$request->setRequestMethod('GET');
$request->setHeaders([
  'x-fungenerators-api-secret' => '{{apiKey}}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/fact/search' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/fact/search' -Method GET -Headers $headers
import http.client

conn = http.client.HTTPSConnection("example.com")

headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }

conn.request("GET", "/baseUrl/fact/search", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/fact/search"

headers = {"x-fungenerators-api-secret": "{{apiKey}}"}

response = requests.get(url, headers=headers)

print(response.json())
library(httr)

url <- "{{baseUrl}}/fact/search"

response <- VERB("GET", url, add_headers('x-fungenerators-api-secret' = '{{apiKey}}'), content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/fact/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fungenerators-api-secret"] = '{{apiKey}}'

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/fact/search') do |req|
  req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/fact/search";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-fungenerators-api-secret", "{{apiKey}}".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.get(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/fact/search \
  --header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/fact/search \
  x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
  --method GET \
  --header 'x-fungenerators-api-secret: {{apiKey}}' \
  --output-document \
  - {{baseUrl}}/fact/search
import Foundation

let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/fact/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

{
  "success":{"total":1},
  "contents":{
    "fact":"There are more than 1,100 known tributaries flowing into the Amazon River. Tributaries are sources of water such as a small river, stream  or other water flow that reaches the river.",
    "id":"LCN5KlSn6BMpcm3ruXhfGweF",
    "category": "Rivers",
    "subcategory": "Amazon River"
      
  }
  
    
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
    "error": {
        "code": 401,
        "message": "Unauthorized"
    }
}