testapi.pndlm.net

Source Code

https://bitbucket.org/pndlm/pndlm-testapi

Authentication

Username: blarson
Password: speedo123

This API will accept cookie or bearer token authentication. After logging in via /api/v0/auth/login, a session cookie will be set. Include this cookie or bearer token in subsequent requests to access protected endpoints.

Endpoints

POST /api/v0/auth/login
Authenticate and receive a session token.

Request:

{ "Username": "string", "Password": "string" }

Response (200 OK):

{ "Token": "string" }

Response (401 Unauthorized):

Invalid credentials

Example:

curl -X POST https://testapi.pndlm.net/api/v0/auth/login \ -H "Content-Type: application/json" \ -d '{"Username":"blarson","Password":"speedo123"}' \ -c cookies.txt
POST /api/v0/auth/logout
Log out and clear the session cookie.

Response (200 OK):

Session cookie is deleted. No response body.

Example:

curl -X POST https://testapi.pndlm.net/api/v0/auth/logout \ -b cookies.txt -c cookies.txt
GET /api/v0/status
Check authentication status.

Response (200 OK):

{ "IsAuthenticated": false, "Username": "" }

Or when authenticated:

{ "IsAuthenticated": true, "Username": "string" }

Example:

curl https://testapi.pndlm.net/api/v0/status \ -b cookies.txt
GET /api/v0/joke 🔒 Authentication Required
Get a joke.

Response (200 OK):

{ "Joke": "string" }

Response (401 Unauthorized):

Not authenticated

Example:

curl https://testapi.pndlm.net/api/v0/joke \ -b cookies.txt