Skip to main content

Insomnia API Testing Workspace

This directory contains the Insomnia workspace configuration for testing the FishingLog API.

🚀 Quick Start

1. Install Insomnia

Download and install Insomnia from: https://insomnia.rest/download

2. Import Workspace

  1. Open Insomnia
  2. Click CreateImport FromFile
  3. Select insomnia/FishingLog API-wrk_a06d10d105e24bc68e7dac3e6c97f43b.yaml
  4. The workspace will be imported with all environments (Local, Staging, Production) and requests

Note: The filename includes the workspace ID (wrk_...). This is required for Git Sync to work properly.

  1. In Insomnia, go to PreferencesDataGit Sync
  2. Enable Git Sync
  3. Connect to your repository:
    • Repository: Your GitHub/GitLab repository URL
    • Branch: main or staging
    • Directory: insomnia/
  4. Insomnia will sync changes automatically

4. Set Up Environments

Local Development Environment

  1. Select Local Development environment from dropdown
  2. Update environment variables if needed:
    • base_url: https://localhost:5100 (HTTPS) or http://localhost:5101 (HTTP)
    • api_url: Same as base_url
    • cognito_domain: Your Cognito domain (if different)

Staging Environment

  1. Select Staging environment from dropdown
  2. Environment variables are pre-configured:
    • base_url: https://api-staging.reelog.app
    • api_url: https://api-staging.reelog.app

5. Get Authentication Token

  1. Use AWS Cognito Hosted UI or AWS CLI to get tokens
  2. Copy the access_token from the response
  3. In Insomnia, go to Manage Environments
  4. Add to your environment:
    • Key: access_token
    • Value: Your JWT token

Option 2: Using Insomnia Cognito Request

  1. Update the Cognito Login request with your credentials
  2. Send the request
  3. Copy the access_token from response
  4. Add to environment variables (see above)

📁 Workspace Structure

Comprehensive endpoint coverage organized by feature:

FishingLog API/
├── Health & Status/
├── Authentication/
├── Users & Profiles/
├── Fishing Logs/
├── Social/
├── Gear/
├── Tournaments/
├── Spots & Reports/
├── Personal Bests/
├── Circles/
├── Events & Clubs/
├── Reference Data/
├── Charters/
└── Themes/

See SETUP.md for complete structure details.

🔐 Authentication

All authenticated endpoints require a JWT Bearer token:

Authorization: Bearer \{\{ _.access_token \}\}

The token is automatically inserted from environment variables.

Getting a Token

Using AWS CLI:

aws cognito-idp initiate-auth \
--auth-flow USER_PASSWORD_AUTH \
--client-id 6i1opt39o2n5h5ihq471l1ev07 \
--auth-parameters USERNAME=your-username,PASSWORD=your-password \
--region us-east-2

Using Cognito Hosted UI:

  1. Visit: https://YOUR_COGNITO_DOMAIN.auth.us-east-2.amazoncognito.com/login
  2. Login with your credentials
  3. Copy the access_token from the URL or response

🌍 Environments

Local Development

  • Base URL: https://localhost:5100 (HTTPS) or http://localhost:5101 (HTTP)
  • Use for: Local development and testing
  • Database: Local PostgreSQL (if configured)

Staging

  • Base URL: https://api-staging.reelog.app
  • Use for: Testing deployed staging environment
  • Database: AWS RDS PostgreSQL (staging)

Production

  • Base URL: https://api.reelog.app
  • Use for: Production API (when deployed)
  • Database: AWS RDS PostgreSQL (production)

📝 Adding New Requests

  1. Right-click on a folder → New Request
  2. Set the URL using environment variables: `\{\{ _.api_url \}\}/api/endpoint`
  3. Add Authorization header: `Bearer \{\{ _.access_token \}\}`
  4. Save the request

🔄 Git Sync Best Practices

  1. Commit regularly: Commit your Insomnia workspace changes
  2. Don't commit tokens: Use environment variables, not hardcoded tokens
  3. Share environment templates: Keep environment structure in sync
  4. Document custom requests: Add descriptions to requests

🛠️ Troubleshooting

"Invalid token" errors

  • Check that access_token is set in your environment
  • Verify token hasn't expired (Cognito tokens expire after 1 hour)
  • Regenerate token if needed

"Connection refused" (Local)

  • Make sure your local API is running: dotnet run
  • Check the port matches your environment (5101 for HTTP)

"502 Bad Gateway" (Staging)

  • Check ECS service is running
  • Verify health checks are passing
  • Check CloudWatch logs for errors

📚 Resources

🔒 Security Notes

  • Never commit tokens to git
  • Use environment variables for sensitive data
  • Use .gitignore to exclude token files if needed
  • Rotate tokens regularly

Last Updated: December 10, 2025