Skip to Content
🚀 APSO is now in public beta. Get started →
ConnectTesting Your API

Testing Your API

APSO provides multiple ways to test and explore your generated API. This guide covers Swagger UI, curl, and popular API clients.

Swagger UI

Every APSO server includes built-in Swagger documentation:

http://localhost:3001/api/docs

Features

  • Interactive API exploration
  • Request builder with form fields
  • Response visualization
  • Authentication support
  • Schema documentation

Authenticating in Swagger

  1. Click Authorize button
  2. Enter your Bearer token: Bearer <your-token>
  3. Click Authorize
  4. All requests will include your token

Using curl

Health Check

curl http://localhost:3001/health

Get All Records

curl -X GET http://localhost:3001/api/v1/projects \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json"

Get Single Record

curl -X GET http://localhost:3001/api/v1/projects/<id> \ -H "Authorization: Bearer <token>"

Create Record

curl -X POST http://localhost:3001/api/v1/projects \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "name": "New Project", "description": "Project description" }'

Update Record

curl -X PATCH http://localhost:3001/api/v1/projects/<id> \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Name" }'

Delete Record

curl -X DELETE http://localhost:3001/api/v1/projects/<id> \ -H "Authorization: Bearer <token>"

Query Parameters

Pagination

# Get page 2 with 10 items per page curl "http://localhost:3001/api/v1/projects?limit=10&offset=10" \ -H "Authorization: Bearer <token>"

Filtering

# Filter by status curl "http://localhost:3001/api/v1/projects?status=active" \ -H "Authorization: Bearer <token>" # Multiple filters curl "http://localhost:3001/api/v1/projects?status=active&priority=1" \ -H "Authorization: Bearer <token>"

Sorting

# Sort by createdAt descending curl "http://localhost:3001/api/v1/projects?sortBy=createdAt&sortOrder=desc" \ -H "Authorization: Bearer <token>"

Including Relations

# Include related tasks curl "http://localhost:3001/api/v1/projects?include=tasks" \ -H "Authorization: Bearer <token>"

Postman

Import OpenAPI Spec

  1. Open Postman
  2. Click Import
  3. Enter: http://localhost:3001/api/docs-json
  4. Click Import

All endpoints are now available in Postman.

Set Up Environment

Create a Postman environment with:

VariableValue
baseUrlhttp://localhost:3001
token<your-bearer-token>

Request Examples

GET Projects:

GET {{baseUrl}}/api/v1/projects Authorization: Bearer {{token}}

POST Project:

POST {{baseUrl}}/api/v1/projects Authorization: Bearer {{token}} Content-Type: application/json { "name": "New Project" }

Insomnia

Import OpenAPI

  1. Open Insomnia
  2. Application > Preferences > Data > Import
  3. Choose From URL
  4. Enter: http://localhost:3001/api/docs-json

Configure Auth

Set up Bearer Token authentication:

  1. Select a request
  2. Go to Auth tab
  3. Choose Bearer Token
  4. Enter your token

HTTPie

HTTPie provides a cleaner CLI experience:

# Install brew install httpie # GET request http GET localhost:3001/api/v1/projects \ Authorization:"Bearer <token>" # POST request http POST localhost:3001/api/v1/projects \ Authorization:"Bearer <token>" \ name="New Project"

VS Code REST Client

Create a .http file in VS Code:

### Variables @baseUrl = http://localhost:3001 @token = your-bearer-token ### Get all projects GET {{baseUrl}}/api/v1/projects Authorization: Bearer {{token}} ### Create project POST {{baseUrl}}/api/v1/projects Authorization: Bearer {{token}} Content-Type: application/json { "name": "New Project" }

Click Send Request above each request to execute.

Authentication Testing

Login Flow

# Register curl -X POST http://localhost:3001/api/auth/signup \ -H "Content-Type: application/json" \ -d '{ "email": "test@example.com", "password": "password123" }' # Login curl -X POST http://localhost:3001/api/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "test@example.com", "password": "password123" }' # Response includes access token { "accessToken": "eyJ...", "refreshToken": "...", "user": { ... } }

API Key Authentication

curl -X GET http://localhost:3001/api/v1/projects \ -H "X-API-Key: your-api-key"

Response Codes

CodeMeaningAction
200SuccessRequest completed
201CreatedResource created
400Bad RequestCheck request body
401UnauthorizedAdd/check auth token
403ForbiddenCheck permissions
404Not FoundResource doesn’t exist
422Validation ErrorCheck field values
500Server ErrorCheck server logs
Last updated on