Documentation

DepartCart API Postman Collection

This Postman collection provides comprehensive testing capabilities for the DepartCart API.

Files Included

  1. DepartCart_API_Collection.postman_collection.json - Main collection with all API requests
  2. DepartCart_Environment.postman_environment.json - Environment variables for API credentials
  3. README_Postman_Collection.md - This documentation file

Setup Instructions

1. Import into Postman

  1. Open Postman
  2. Click "Import" button
  3. Import both files:
  4. DepartCart_API_Collection.postman_collection.json
  5. DepartCart_Environment.postman_environment.json

2. Configure Environment Variables

After importing, you need to update the environment variables with actual API credentials:

  1. In Postman, go to "Environments"
  2. Select "DepartCart Environment"
  3. Update the following variables with actual values from your .env file or environment variables:

api_key: Your API_KEY value

api_secret: Your API_SECRET value

  1. Make sure the environment is selected in Postman (top-right dropdown)

3. Update Base URL (if needed)

The collection is configured for https://departcart.com by default. If your server runs on a different URL:

  1. Update the base_url variable in the environment
  2. Or modify individual request URLs as needed

Collection Structure

📁 Authentication

Bearer token generation endpoints: - Generate Bearer Token

📁 URL Generation

API endpoints for generating encrypted deeplinks: - Generate Encrypted Seatmap URL — seatmap deeplink only (relative path) - Generate All Deeplinks (Seatmap, Cart, Checkout) — returns absolute seatmap, cart, and checkout URLs

Usage Workflow

Step 1: Generate Bearer Token

  1. Select the appropriate "Generate Bearer Token" request for your brand
  2. Click "Send"
  3. The response will contain a bearer token
  4. The token is automatically saved to environment variables for use in subsequent requests

Example Response:

{
  "success": true,
  "bearer_token": "demo:1704312000:1704398400:abc123:signature",
  "token_type": "Bearer",
  "expires_in": 86400,
  "expires_at": 1704398400,
  "brand": "demo",
  "usage": "Authorization: Bearer demo:1704312000:1704398400:abc123:signature"
}

Step 2: Generate Encrypted Seatmap URL

  1. Modify the request body with your PNR and passenger details: json { "pnr": "ABC123", "last_name": "SMITH", "source": "api" } The brand is derived from the bearer token, so no brand field is required in the request body.
  2. Click "Send"
  3. The response will contain the encrypted seatmap URL

Example Response:

{
  "success": true,
  "encrypted_id": "encrypted_booking_id_here",
  "seatmap_url": "/seatmap?id=encrypted_id&source=api",
  "source": "api"
}

API Endpoints Reference

POST /generate-bearer-token

Generates a bearer token for API authentication.

Request Body:

{
  "api_key": "your_api_key",
  "api_secret": "your_api_secret",
  "duration_hours": 24
}

POST /api/generate-encrypted-seatmap-url

Generates an encrypted seatmap URL. The brand is derived from the bearer token, so no brand field is required in the request body.

Headers:

Authorization: Bearer {your_bearer_token}
Content-Type: application/json

Request Body:

{
  "pnr": "ABC123",
  "last_name": "SMITH",
  "source": "api"
}

Response:

{
  "success": true,
  "encrypted_id": "encrypted_booking_id_here",
  "seatmap_url": "/seatmap?id=encrypted_id&source=api",
  "source": "api"
}

POST /generate-encrypted-url

Generates encrypted deeplinks for a booking and returns the seatmap, cart, and checkout URLs as absolute URLs. The brand is derived from the bearer token, so no brand field is required in the request body.

Headers:

Authorization: Bearer {your_bearer_token}
Content-Type: application/json

Request Body:

{
  "pnr": "ABC123",
  "last_name": "SMITH",
  "source": "cart"
}

Response:

{
  "success": true,
  "encrypted_id": "encrypted_booking_id_here",
  "seatmap_url": "https://departcart.com/seatmap?id=encrypted_id&source=cart",
  "cart_url": "https://departcart.com/cart?id=encrypted_id",
  "checkout_url": "https://departcart.com/checkout?id=encrypted_id",
  "source": "cart"
}

Testing Features

  • Automatic token storage: Bearer tokens are automatically saved to environment variables
  • Response validation: Test scripts verify successful responses and required fields
  • Console logging: URLs and important data are logged to Postman console
  • Error handling: Tests check for proper error responses

Environment Variables Reference

Variable Description Auto-Set
base_url API base URL No
api_key API key No
api_secret API secret No
bearer_token Bearer token Yes

Troubleshooting

Authentication Errors

  • Verify API key/secret values in environment variables
  • Check that bearer token was generated successfully
  • Ensure Authorization header is properly formatted

URL Generation Errors

  • Verify PNR and last_name are provided
  • Check that bearer token is valid and not expired
  • The brand is derived from the bearer token; ensure the token was generated with the correct credentials

Connection Errors

  • Verify the Flask application is running
  • Check the base_url environment variable

Security Notes

  • Never commit actual API credentials to version control
  • Bearer tokens expire after the specified duration (default: 24 hours)
  • Store sensitive credentials in Postman environment variables, not in the collection itself
  • Use environment-specific credentials for different deployment environments

Support

For issues with the API endpoints or authentication, refer to the DepartCart documentation or contact the development team.