Authentication
Authenticating and Obtaining a Token
To authenticate and receive an authorization token, make a POST request to the following address
https://app.privateadserver.com/api/signin/
Request
Request should have a JSON body containing your email and password.
{
"email":"[email protected]",
"password":"yourpassword"
}
Response
Successful Authentication (200 OK): The response will include a JSON with the user's token and details.
Failed Authentication (401 Unauthorized): Indicates incorrect credentials.
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6...",
"user": {
"ID": 1,
"userID": 1,
"createdAt": "2023-05-15T08:52:09.15693Z",
"updatedAt": "2023-05-15T08:52:09.163817Z",
"DeletedAt": null,
"accountID": 1,
"name": "You",
"email": "[email protected]",
"status": 1,
"role": 1
}
}
Usage
Use the obtained token for subsequent authenticated requests to the ad server's API. The server is using the autherization header, each request shosuld contain the header with the obtained token like in the following example:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6...
Examples
CURL
curl -X POST https://app.privateadserver.com/api/signin/ \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "yourpassword"}'
Python Example
import requests
import json
url = "https://app.privateadserver.com/api/signin/"
data = {"email": "[email protected]", "password": "yourpassword"}
response = requests.post(url, json=data)
if response.status_code == 200:
token = response.json()['token']
# Use token for further authenticated requests
else:
print("Authentication failed with status code:", response.status_code)
Last updated