REST API
To get started with the REST API, visit the API endpoints at http://localhost/api/ or http://localhost:8001/api/ if you run on a local development setup.
Authentication
When the authentication setting FEDERATEDCODE_REQUIRE_AUTHENTICATION
is enabled on a FederatedCode instance (disabled by default), you will have to include
an authentication token API key in the Authorization HTTP header of each request.
The key should be prefixed by the string literal “Token” with whitespace separating the two strings. For example:
Authorization: Token abcdef123456
Warning
Your API key is like a password and should be treated with the same care.
Example of a cURL-style command line using an API Key for authentication:
curl -X GET http://localhost/api/ -H "Authorization:Token abcdef123456"
Example of a Python script:
import requests
api_url = "http://localhost/api/"
headers = {
"Authorization": "Token abcdef123456",
}
params = {
"page": "2",
}
response = requests.get(api_url, headers=headers, params=params)
response.json()