Minimum request #
curl -X POST "https://api.example.com/v1/web-unblocker/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target_url": "https://example.com"
}'
Node.js example #
const response = await fetch("https://api.example.com/v1/web-unblocker/query", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
target_url: "https://example.com"
})
});
const result = await response.json();
if (result.code !== 200) {
console.error("Request failed", result.code, result.message);
} else {
console.log(result.data.html);
}
Python example #
import requests
response = requests.post(
"https://api.example.com/v1/web-unblocker/query",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"target_url": "https://example.com", },
)
result = response.json()
if result.get("code") != 200:
print("Request failed", result.get("code"), result.get("message"))
else:
print(result["data"]["html"])
PHP example #
<?php
$payload = json_encode([
'target_url' => 'https://example.com',
], JSON_UNESCAPED_SLASHES);
$ch = curl_init('https://api.example.com/v1/web-unblocker/query');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
echo 'Request failed: ' . curl_error($ch);
curl_close($ch);
exit;
}
curl_close($ch);
$result = json_decode($response, true);
if (($result['code'] ?? null) !== 200) {
echo 'Request failed: ' . ($result['code'] ?? '-') . ' ' . ($result['message'] ?? '-');
} else {
echo $result['data']['html'];
}
Go example #
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]string{
"target_url": "https://example.com",
})
req, _ := http.NewRequest(
http.MethodPost,
"https://api.example.com/v1/web-unblocker/query",
bytes.NewBuffer(payload),
)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Request failed", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Java example #
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class WebUnblockerExample {
public static void main(String[ ] args) throws Exception {
String body = "{\"target_url\":\"https://example.com\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.example.com/v1/web-unblocker/query"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}