Insomnia REST Client Setup
Learn how to use Insomnia REST client with the PortPulse API for testing and development.
Installation
- Download Insomnia for your platform
- Install and launch the application
- Create a free account or sign in
Import PortPulse Collection
Method 1: Import from URL
- Click Create → Import from URL
- Enter:
https://api.useportpulse.com/openapi.json - Click Import
- Select "OpenAPI 3.0" format when prompted
Method 2: Import from File
- Download the OpenAPI spec:
curl -o portpulse-openapi.json https://api.useportpulse.com/openapi.json - In Insomnia: Create → Import from File
- Select the downloaded
portpulse-openapi.json - Click Import
Environment Setup
- Click Manage Environments (gear icon)
- Click + Create Environment
- Name it "PortPulse Production"
- Add these variables:
{
"baseUrl": "https://api.useportpulse.com",
"apiKey": "dev_demo_123"
}
- Click Done
- Select "PortPulse Production" from the environment dropdown
Authentication Setup
For all requests, add the API key header:
- Go to any request in your collection
- Click the Headers tab
- Add header:
- Name:
X-API-Key - Value:
{{ _.apiKey }}
- Name:
Make Your First Request
1. Health Check
GET {{ _.baseUrl }}/v1/health
Expected response:
{
"status": "healthy",
"version": "1.0.0",
"timestamp": "2025-09-16T10:30:00Z"
}
2. Port Overview
GET {{ _.baseUrl }}/v1/ports/USLAX/overview
X-API-Key: {{ _.apiKey }}
Expected response:
{
"port_code": "USLAX",
"name": "Los Angeles",
"country": "US",
"congestion_score": 0.45,
"vessels_at_anchor": 12,
"avg_wait_hours": 18.5,
"last_updated": "2025-09-16T08:00:00Z"
}
Working with CSV & ETag Caching
Request CSV Format
GET {{ _.baseUrl }}/v1/ports/USLAX/trend?days=30&format=csv
X-API-Key: {{ _.apiKey }}
Check ETag Support
- Send the CSV request above
- Note the response headers:
ETag: "abc123def456"Cache-Control: public, max-age=300
Test 304 Not Modified
- Copy the ETag value from the previous response
- Create a new request with:
GET {{ _.baseUrl }}/v1/ports/USLAX/trend?days=30&format=csv
X-API-Key: {{ _.apiKey }}
If-None-Match: "abc123def456" - You should receive a
304 Not Modifiedresponse
Common Use Cases
Port Trends (JSON)
GET {{ _.baseUrl }}/v1/ports/USLAX/trend?days=30&format=json
X-API-Key: {{ _.apiKey }}
Port Alerts
GET {{ _.baseUrl }}/v1/ports/USLAX/alerts
X-API-Key: {{ _.apiKey }}
Multiple Ports Comparison
Create separate requests for:
- USLAX (Los Angeles)
- USLGB (Long Beach)
- USNYC (New York/New Jersey)
- SGSIN (Singapore)
Response Validation
Insomnia automatically validates JSON responses. For additional validation:
- Go to the Tests tab in your request
- Add JavaScript validation:
const response = insomnia.response;
// Check status code
expect(response.status).to.equal(200);
// Check required headers
expect(response.headers['x-request-id']).to.exist;
expect(response.headers['cache-control']).to.exist;
// Validate JSON structure
const data = JSON.parse(response.body);
expect(data).to.have.property('port_code');
expect(data.congestion_score).to.be.a('number');
Troubleshooting
Common Issues
401 Unauthorized
- Check your API key is correct
- Ensure
X-API-Keyheader is included - Verify the environment variable
{{ _.apiKey }}is resolving
404 Not Found
- Verify the port code format (use UN/LOCODE like 'USLAX')
- Check the endpoint URL is correct
- Ensure base URL doesn't have trailing slash
Rate Limiting (429)
- Wait for the rate limit to reset
- Check
X-RateLimit-Resetheader for reset time - Consider upgrading your plan for higher limits
Getting Help
Pro Tips
- Save time: Use environment variables for commonly changed values
- Debug easily: Enable request/response logging in Insomnia settings
- Test efficiently: Use the Send and Download option for large CSV files
- Stay organized: Group related requests in folders within your collection
- Monitor usage: Check response headers for rate limit information
Download OpenAPI (YAML)
- 👉 Download Insomnia OpenAPI YAML
- In Insomnia: Create → Import from File and select the YAML.