Peegin API Documentation

The Peegin public API gives you access to a limited features of the platform. This lets you use the basic features that can be needed in daily scenerios. It is a RESTful API and is
organized around the main resources you would be interacting with - with a few exceptions.
You do not need an account to be able to use the public API.

1. 100 Most Recent Words

Client Code

PHP

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://peegin.com/api/public/peegins/recent",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
));

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

curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

JAVA

HttpResponse<String> response = Unirest.get("https://peegin.com/api/public/peegins/recent").asString();

JavaScript

var data = null;

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

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

xhr.open("GET", "https://peegin.com/api/public/peegins/recent");

xhr.send(data);

Python


import http.client

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

payload = ""

conn.request("GET", "/api/public/peegins/recent", payload, headers)

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

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

Ruby

require 'uri'
require 'net/http'

url = URI("https://peegin.com/api/public/peegins/recent")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

2. Random Peegin Words

Client Code

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://peegin.com/api/public/peegins/random",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Java

HttpResponse<String> response = Unirest.get("https://peegin.com/api/public/peegins/random").asString();

JavaScript

var data = null;

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

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

xhr.open("GET", "https://peegin.com/api/public/peegins/random");

xhr.send(data);HttpResponse<String> response = Unirest.get("https://peegin.com/api/public/peegins/random")
  .asString();

Python

import http.client

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

payload = ""

conn.request("GET", "/api/public/peegins/random", payload, headers)

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

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

Ruby

require 'uri'
require 'net/http'

url = URI("https://peegin.com/api/public/peegins/random")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

3. Search Peegin

Client Code

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://peegin.com/api/public/peegins/search?search=shima",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Java

HttpResponse<String> response = Unirest.get("https://peegin.com/api/public/peegins/search?search=shima")
  .asString();

JavaScript

var data = null;

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

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

xhr.open("GET", "https://peegin.com/api/public/peegins/search?search=shima");

xhr.send(data);

Python

import http.client

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

payload = ""

conn.request("GET", "/api/public/peegins/search?search=shima", payload, headers)

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

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

Ruby

require 'uri'
require 'net/http'

url = URI("https://peegin.com/api/public/peegins/search?search=shima")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

Success Response: 200 OK