Shakespeare API
GET
Generate Shakespeare lorem ipsum.
{{baseUrl}}/shakespeare/generate/lorem-ipsum
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}}/shakespeare/generate/lorem-ipsum");
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}}/shakespeare/generate/lorem-ipsum" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/shakespeare/generate/lorem-ipsum"
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}}/shakespeare/generate/lorem-ipsum"),
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}}/shakespeare/generate/lorem-ipsum");
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}}/shakespeare/generate/lorem-ipsum"
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/shakespeare/generate/lorem-ipsum HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/shakespeare/generate/lorem-ipsum")
.setHeader("x-fungenerators-api-secret", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/shakespeare/generate/lorem-ipsum"))
.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}}/shakespeare/generate/lorem-ipsum")
.get()
.addHeader("x-fungenerators-api-secret", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/shakespeare/generate/lorem-ipsum")
.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}}/shakespeare/generate/lorem-ipsum');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/shakespeare/generate/lorem-ipsum',
headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/shakespeare/generate/lorem-ipsum';
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}}/shakespeare/generate/lorem-ipsum',
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}}/shakespeare/generate/lorem-ipsum")
.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/shakespeare/generate/lorem-ipsum',
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}}/shakespeare/generate/lorem-ipsum',
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}}/shakespeare/generate/lorem-ipsum');
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}}/shakespeare/generate/lorem-ipsum',
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}}/shakespeare/generate/lorem-ipsum';
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}}/shakespeare/generate/lorem-ipsum"]
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}}/shakespeare/generate/lorem-ipsum" 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}}/shakespeare/generate/lorem-ipsum",
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}}/shakespeare/generate/lorem-ipsum', [
'headers' => [
'x-fungenerators-api-secret' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/shakespeare/generate/lorem-ipsum');
$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}}/shakespeare/generate/lorem-ipsum');
$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}}/shakespeare/generate/lorem-ipsum' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/shakespeare/generate/lorem-ipsum' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }
conn.request("GET", "/baseUrl/shakespeare/generate/lorem-ipsum", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/shakespeare/generate/lorem-ipsum"
headers = {"x-fungenerators-api-secret": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/shakespeare/generate/lorem-ipsum"
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}}/shakespeare/generate/lorem-ipsum")
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/shakespeare/generate/lorem-ipsum') 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}}/shakespeare/generate/lorem-ipsum";
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}}/shakespeare/generate/lorem-ipsum \
--header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/shakespeare/generate/lorem-ipsum \
x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-fungenerators-api-secret: {{apiKey}}' \
--output-document \
- {{baseUrl}}/shakespeare/generate/lorem-ipsum
import Foundation
let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/shakespeare/generate/lorem-ipsum")! 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": 5,
"limit": 5
},
"contents": {
"lorem-ipsum": "[\"Something wicked this way comes. Those his goodly eyes, That o'er the files and musters of the war Have glow'd like plated Mars, now bend, now turn, The office and devotion of their view Upon a tawny front. Let Rome in Tiber melt, and the wide arch Of the rang'd empire fall! Here is my space. Kingdoms are clay; O unhappy youth! Come not within these doors; within this roof The enemy of all your graces lives. This is no place; this house is but a butchery; Abhor it, fear it, do not enter it. When I did hear The motley fool thus moral on the time, My lungs began to crow like chanticleer That fools should be so deep contemplative; And I did laugh sans intermission An hour by his dial. O noble fool! A worthy fool! Motley's the only wear.\",\"The wheel is come full circle. But this denoted a foregone conclusion: He lets me feed with his hinds, bars me the place of a brother, and as much as in him lies, mines my gentility with my education. And then the lover, Sighing like furnace, with a woeful ballad Made to his mistress' eyebrow. You must borrow me Gargantua's mouth first; 'tis a word too great for any mouth of this age's size. To say ay and no to these particulars is more than to answer in a catechism. You have a nimble wit; I think 'twas made of Atalanta's heels. Will you sit down with me? and we two will rail against our mistress the world, and all our misery.\",\"Neither a borrower or a lender be. Yes, so please your Majesty. I did go between them, as I said; but more than that, he loved her-for indeed he was mad for her, and talk'd of Satan, and of Limbo, and of Furies, and I know not what. Good mother, fetch my bail. Stay, royal sir; More, more, I prithee, more. And then he drew a dial from his poke, And, looking on it with lack-lustre eye, Says very wisely, 'It is ten o'clock; Thus we may see,' quoth he, 'how the world wags; 'Tis but an hour ago since it was nine; And after one hour more 'twill be eleven; And so, from hour to hour, we ripe and ripe, And then, from hour to hour, we rot and rot; And thereby hangs a tale.' The sixth age shifts Into the lean and slipper'd pantaloon, With spectacles on nose and pouch on side, His youthful hose, well sav'd, a world too wide For his shrunk shank; and his big manly voice, Turning again toward childish treble, pipes And whistles in his sound. As it is a spare life, look you, it fits my humour well; but as there is no more plenty in it, it goes much against my stomach. Most shallow man! thou worm's meat in respect of a good piece of flesh indeed! Learn of the wise, and perpend: civet is of a baser birth than tar- the very uncleanly flux of a cat. Mend the instance, shepherd.\",\"It is meat and drink to me to see a clown: That's meat and drink to me, now. The course of true love never did run smooth. I will wear my heart upon my sleeve A miserable world! As I do live by food, I met a fool, Who laid him down and bask'd him in the sun, And rail'd on Lady Fortune in good terms, In good set terms- and yet a motley fool. At first the infant, Mewling and puking in the nurse's arms; Then the whining school-boy, with his satchel And shining morning face, creeping like snail Unwillingly to school. Now in respect it is in the fields, it pleaseth me well; but in respect it is not in the court, it is tedious. You must borrow me Gargantua's mouth first; 'tis a word too great for any mouth of this age's size. To say ay and no to these particulars is more than to answer in a catechism.\",\"It beggared all description. more in sorrow than in anger. You must borrow me Gargantua's mouth first; 'tis a word too great for any mouth of this age's size. To say ay and no to these particulars is more than to answer in a catechism.\"]"
},
"copyright": "https://fungenerators.com/"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"code": 401,
"message": "Unauthorized"
}
}
GET
Generate random Shakespeare style insults.
{{baseUrl}}/shakespeare/generate/insult
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}}/shakespeare/generate/insult");
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}}/shakespeare/generate/insult" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/shakespeare/generate/insult"
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}}/shakespeare/generate/insult"),
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}}/shakespeare/generate/insult");
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}}/shakespeare/generate/insult"
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/shakespeare/generate/insult HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/shakespeare/generate/insult")
.setHeader("x-fungenerators-api-secret", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/shakespeare/generate/insult"))
.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}}/shakespeare/generate/insult")
.get()
.addHeader("x-fungenerators-api-secret", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/shakespeare/generate/insult")
.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}}/shakespeare/generate/insult');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/shakespeare/generate/insult',
headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/shakespeare/generate/insult';
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}}/shakespeare/generate/insult',
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}}/shakespeare/generate/insult")
.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/shakespeare/generate/insult',
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}}/shakespeare/generate/insult',
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}}/shakespeare/generate/insult');
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}}/shakespeare/generate/insult',
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}}/shakespeare/generate/insult';
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}}/shakespeare/generate/insult"]
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}}/shakespeare/generate/insult" 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}}/shakespeare/generate/insult",
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}}/shakespeare/generate/insult', [
'headers' => [
'x-fungenerators-api-secret' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/shakespeare/generate/insult');
$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}}/shakespeare/generate/insult');
$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}}/shakespeare/generate/insult' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/shakespeare/generate/insult' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }
conn.request("GET", "/baseUrl/shakespeare/generate/insult", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/shakespeare/generate/insult"
headers = {"x-fungenerators-api-secret": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/shakespeare/generate/insult"
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}}/shakespeare/generate/insult")
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/shakespeare/generate/insult') 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}}/shakespeare/generate/insult";
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}}/shakespeare/generate/insult \
--header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/shakespeare/generate/insult \
x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-fungenerators-api-secret: {{apiKey}}' \
--output-document \
- {{baseUrl}}/shakespeare/generate/insult
import Foundation
let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/shakespeare/generate/insult")! 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": 5,
"limit": 5
},
"contents": {
"taunts": [
"Thou cockered clapper-clawed mammet!",
"Thou dissembling weather-bitten rampallion!",
"Thou churlish evil-eyed pigeon-egg!",
"Thou saucy onion-eyed moldwarp!",
"Thou bootless onion-eyed measle!"
]
},
"copyright": "https://fungenerators.com/"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"code": 401,
"message": "Unauthorized"
}
}
GET
Generate random Shakespearen names.
{{baseUrl}}/shakespeare/generate/name
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}}/shakespeare/generate/name");
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}}/shakespeare/generate/name" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/shakespeare/generate/name"
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}}/shakespeare/generate/name"),
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}}/shakespeare/generate/name");
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}}/shakespeare/generate/name"
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/shakespeare/generate/name HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/shakespeare/generate/name")
.setHeader("x-fungenerators-api-secret", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/shakespeare/generate/name"))
.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}}/shakespeare/generate/name")
.get()
.addHeader("x-fungenerators-api-secret", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/shakespeare/generate/name")
.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}}/shakespeare/generate/name');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/shakespeare/generate/name',
headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/shakespeare/generate/name';
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}}/shakespeare/generate/name',
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}}/shakespeare/generate/name")
.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/shakespeare/generate/name',
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}}/shakespeare/generate/name',
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}}/shakespeare/generate/name');
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}}/shakespeare/generate/name',
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}}/shakespeare/generate/name';
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}}/shakespeare/generate/name"]
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}}/shakespeare/generate/name" 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}}/shakespeare/generate/name",
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}}/shakespeare/generate/name', [
'headers' => [
'x-fungenerators-api-secret' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/shakespeare/generate/name');
$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}}/shakespeare/generate/name');
$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}}/shakespeare/generate/name' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/shakespeare/generate/name' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }
conn.request("GET", "/baseUrl/shakespeare/generate/name", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/shakespeare/generate/name"
headers = {"x-fungenerators-api-secret": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/shakespeare/generate/name"
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}}/shakespeare/generate/name")
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/shakespeare/generate/name') 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}}/shakespeare/generate/name";
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}}/shakespeare/generate/name \
--header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/shakespeare/generate/name \
x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-fungenerators-api-secret: {{apiKey}}' \
--output-document \
- {{baseUrl}}/shakespeare/generate/name
import Foundation
let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/shakespeare/generate/name")! 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": 5,
"start": 0,
"limit": 5
},
"contents": {
"variation": "male",
"names": [
"Varrius Quince",
"Fabian Tearsheet",
"Capucius Flute",
"Guiderius Wolsey",
"Silvius Stafford"
]
},
"copyright": "https://fungenerators.com/"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"code": 401,
"message": "Unauthorized"
}
}
GET
Translate from English to Shakespeare English.
{{baseUrl}}/shakespeare/translate
HEADERS
X-Fungenerators-Api-Secret
{{apiKey}}
QUERY PARAMS
text
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/shakespeare/translate?text=");
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}}/shakespeare/translate" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}
:query-params {:text ""}})
require "http/client"
url = "{{baseUrl}}/shakespeare/translate?text="
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}}/shakespeare/translate?text="),
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}}/shakespeare/translate?text=");
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}}/shakespeare/translate?text="
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/shakespeare/translate?text= HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/shakespeare/translate?text=")
.setHeader("x-fungenerators-api-secret", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/shakespeare/translate?text="))
.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}}/shakespeare/translate?text=")
.get()
.addHeader("x-fungenerators-api-secret", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/shakespeare/translate?text=")
.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}}/shakespeare/translate?text=');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/shakespeare/translate',
params: {text: ''},
headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/shakespeare/translate?text=';
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}}/shakespeare/translate?text=',
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}}/shakespeare/translate?text=")
.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/shakespeare/translate?text=',
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}}/shakespeare/translate',
qs: {text: ''},
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}}/shakespeare/translate');
req.query({
text: ''
});
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}}/shakespeare/translate',
params: {text: ''},
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}}/shakespeare/translate?text=';
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}}/shakespeare/translate?text="]
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}}/shakespeare/translate?text=" 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}}/shakespeare/translate?text=",
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}}/shakespeare/translate?text=', [
'headers' => [
'x-fungenerators-api-secret' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/shakespeare/translate');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'text' => ''
]);
$request->setHeaders([
'x-fungenerators-api-secret' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/shakespeare/translate');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'text' => ''
]));
$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}}/shakespeare/translate?text=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/shakespeare/translate?text=' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }
conn.request("GET", "/baseUrl/shakespeare/translate?text=", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/shakespeare/translate"
querystring = {"text":""}
headers = {"x-fungenerators-api-secret": "{{apiKey}}"}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/shakespeare/translate"
queryString <- list(text = "")
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}}/shakespeare/translate?text=")
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/shakespeare/translate') do |req|
req.headers['x-fungenerators-api-secret'] = '{{apiKey}}'
req.params['text'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/shakespeare/translate";
let querystring = [
("text", ""),
];
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}}/shakespeare/translate?text=' \
--header 'x-fungenerators-api-secret: {{apiKey}}'
http GET '{{baseUrl}}/shakespeare/translate?text=' \
x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-fungenerators-api-secret: {{apiKey}}' \
--output-document \
- '{{baseUrl}}/shakespeare/translate?text='
import Foundation
let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/shakespeare/translate?text=")! 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": {
"translated": "What he did doth englut did maketh him kicketh the bucket",
"text": "What he ate made him die"
},
"copyright": "https://fungenerators.com/"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"code": 401,
"message": "Unauthorized"
}
}
GET
Get a random Shakespeare quote.
{{baseUrl}}/shakespeare/quote
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}}/shakespeare/quote");
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}}/shakespeare/quote" {:headers {:x-fungenerators-api-secret "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/shakespeare/quote"
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}}/shakespeare/quote"),
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}}/shakespeare/quote");
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}}/shakespeare/quote"
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/shakespeare/quote HTTP/1.1
X-Fungenerators-Api-Secret: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/shakespeare/quote")
.setHeader("x-fungenerators-api-secret", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/shakespeare/quote"))
.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}}/shakespeare/quote")
.get()
.addHeader("x-fungenerators-api-secret", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/shakespeare/quote")
.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}}/shakespeare/quote');
xhr.setRequestHeader('x-fungenerators-api-secret', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/shakespeare/quote',
headers: {'x-fungenerators-api-secret': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/shakespeare/quote';
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}}/shakespeare/quote',
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}}/shakespeare/quote")
.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/shakespeare/quote',
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}}/shakespeare/quote',
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}}/shakespeare/quote');
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}}/shakespeare/quote',
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}}/shakespeare/quote';
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}}/shakespeare/quote"]
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}}/shakespeare/quote" 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}}/shakespeare/quote",
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}}/shakespeare/quote', [
'headers' => [
'x-fungenerators-api-secret' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/shakespeare/quote');
$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}}/shakespeare/quote');
$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}}/shakespeare/quote' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-fungenerators-api-secret", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/shakespeare/quote' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-fungenerators-api-secret': "{{apiKey}}" }
conn.request("GET", "/baseUrl/shakespeare/quote", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/shakespeare/quote"
headers = {"x-fungenerators-api-secret": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/shakespeare/quote"
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}}/shakespeare/quote")
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/shakespeare/quote') 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}}/shakespeare/quote";
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}}/shakespeare/quote \
--header 'x-fungenerators-api-secret: {{apiKey}}'
http GET {{baseUrl}}/shakespeare/quote \
x-fungenerators-api-secret:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-fungenerators-api-secret: {{apiKey}}' \
--output-document \
- {{baseUrl}}/shakespeare/quote
import Foundation
let headers = ["x-fungenerators-api-secret": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/shakespeare/quote")! 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": {
"quote": "I could a tale unfold whose lightest wordWould harrow up thy soul, freeze thy young blood,Make thy two eyes like stars start from their spheres,Thy knotted and combined locks to part,And each particular hair to stand on endLike quills upon the fretful porpentine.But this eternal blazon must not beTo ears of flesh and blood.List, list, O list! ",
"author": "William Shakespeare"
},
"copyright": "https://fungenerators.com/"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"code": 401,
"message": "Unauthorized"
}
}