Skip to main content

Authentication

You need to authentication token to access the private resources and to generate access token for playback via Testpress API

Generate authentication token

Make Post request to the below link with the credentials to generate an authentication token.

POST http://demo.testpress.in/api/v2.5/auth-token/

NameTypeDescription
usernamestringUsername of the user
passwordstringPassword of the user

Sample code

import requests

url = "https://demo.testpress.in/api/v2.5/auth-token/"

payload = "{\n \"username\": \"testpress\",\n \"password\": \"demo\"\n}"
headers = {
'content-type': "application/json",
'cache-control': "no-cache",
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
caution

Replace demo with your institute subdomain hereafter everywhere.

Response

The response will return an token which should be prefixed with JWT and included in all API requests to the server in a header that looks like the following:

Authorization: JWT auth-token-string