Readiness check
curl --request GET \
--url https://api.prefetch.io/readyimport requests
url = "https://api.prefetch.io/ready"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prefetch.io/ready', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prefetch.io/ready",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/ready"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/ready")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/ready")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "ready",
"checks": {
"redis": "ok"
}
}{
"status": "degraded",
"checks": {
"redis": "error"
}
}Service
GET /ready
Check that the Prefetch API can accept requests and background jobs. No API key needed, and free.
GET
/
ready
Readiness check
curl --request GET \
--url https://api.prefetch.io/readyimport requests
url = "https://api.prefetch.io/ready"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prefetch.io/ready', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prefetch.io/ready",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/ready"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/ready")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/ready")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "ready",
"checks": {
"redis": "ok"
}
}{
"status": "degraded",
"checks": {
"redis": "error"
}
}Returns
To check only that the API is running, use
200 when the API is ready to handle requests, including the queue that runs crawls, batches and monitor checks. It returns 503 when that queue is unavailable. It needs no API key and costs nothing.
curl https://api.prefetch.io/ready
200 Ready
{ "status": "ok" }
503 Not ready
{ "status": "error", "message": "Redis connection failed" }
GET /health.