How to Make a Request
All requests should be made to https://api2.archery-records.net
All requests must be accompanied by a User Agent header identifying your application. Default headers and the absence of a header will trigger bot protection. A user agent header example is "User-Agent: MyApp/1.0 (+https://mydomain.com)". Replace MyApp and mydomain.com with yours
To make a REST request to an API, you typically use an HTTP client to send a request using the relevant HTTP verb/method (eg GET, POST, PUT, DELETE) to an endpoint. Here's a breakdown of how to do it in different ways:
1. Using curl (Command Line)
bash
curl -X GET "https://api2.archery-records.net/api/<resource>" -H "Authorization: YOUR_API_KEY" -H "Accept: application/json" -H "User-Agent: MyApp/1.0 (+https://mydomain.com)"
-X GET: HTTP method (use POST, PUT, DELETE, etc. as needed)-H: HTTP headers- Add
-d '{"key":"value"}'for data (usually with POST/PUT)
2. Using Python (requests library)
Example:
python
import requests
url = "https://api2.archery-records.net/api/<resource>"
headers = {
"Authorization": "YOUR_API_KEY",
"Accept": "application/json",
"User-Agent": "MyApp/1.0 (+https://mydomain.com)"
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json()) # or response.text
For POST with data:
python
data = {"name": "Alice", "email": "[email protected]"}
response = requests.post(url, json=data, headers=headers)
3. Using JavaScript (Fetch API — Browser or Node.js)
javascript
fetch("https://api2.archery-records.net/api/<resource>", {
method: "GET",
headers: {
"Authorization": "YOUR_API_KEY",
"Accept": "application/json",
"User-Agent": "MyApp/1.0 (+https://mydomain.com)"
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
For POST:
javascript
fetch("https://api2.archery-records.net/api/<resource>", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_API_KEY",
"User-Agent": "MyApp/1.0 (+https://mydomain.com)"
},
body: JSON.stringify({ name: "Alice", email: "[email protected]" })
})
Common Elements of a REST Request
- Method: POST (Create), GET (Read), PUT (Update), DELETE (aka CRUD)
- URL: Endpoint of the API
- Headers: Often includes
Authorization,Content-Type,User-Agent, etc. - Body: JSON data sent with POST/PUT