Making Your First API Request
Setting Up Your API Key
Configure your API key as an environment variable. This approach streamlines your API usage by eliminating the need to include your API key in each request. Moreover, it enhances security by minimizing the risk of inadvertently including your API key in your codebase.
In your terminal of choice:
bash
export MAGISTERIUM_API_KEY=<your-api-key-here>
Or, in your project’s .env file:
bash
MAGISTERIUM_API_KEY=<your-api-key-here>
Replace <your-api-key-here>
with your actual API key obtained from the API Console.
Making Your First Request
Execute this curl command in the terminal of your choice:
bash
curl -X POST https://www.magisterium.com/api/v1/news \
-H "Authorization: Bearer $MAGISTERIUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'