Python
import os
import requests
API = os.environ.get("API", "https://bankworks.info")
KEY = os.environ["API_KEY"]
# One request, twenty pages.
pages = range(1, 21)
urls = [f"https://example.com/p/{n}" for n in pages]
response = requests.post(
f"{API}/v1/jobs",
headers={"Authorization": f"Bearer {KEY}"},
json={"urls": urls},
timeout=30,
)
print(response.json())
Node.js
const API = process.env.API ?? "https://bankworks.info";
const KEY = process.env.API_KEY;
// One request, twenty pages.
const urls = Array.from({ length: 20 }, (_, i) =>
`https://example.com/p/${i + 1}`);
const response = await fetch(`${API}/v1/jobs`, {
method: "POST",
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ urls }),
});
console.log(await response.json());
cURL
# One request, twenty pages.
curl -sS -X POST "$API/v1/jobs" \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d "$(jq -n '{
urls: [range(1; 21) | "https://example.com/p/\(.)"]
}')"