DepartCart API Postman Collection
This Postman collection provides comprehensive testing capabilities for the DepartCart API.
Files Included
- DepartCart_API_Collection.postman_collection.json - Main collection with all API requests
- DepartCart_Environment.postman_environment.json - Environment variables for API credentials
- README_Postman_Collection.md - This documentation file
Setup Instructions
1. Import into Postman
- Open Postman
- Click "Import" button
- Import both files:
DepartCart_API_Collection.postman_collection.jsonDepartCart_Environment.postman_environment.json
2. Configure Environment Variables
After importing, you need to update the environment variables with actual API credentials:
- In Postman, go to "Environments"
- Select "DepartCart Environment"
- Update the following variables with actual values from your
.envfile or environment variables:
api_key: Your API_KEY value
api_secret: Your API_SECRET value
- 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:
- Update the
base_urlvariable in the environment - Or modify individual request URLs as needed
Collection Structure
📁 Authentication
Bearer token generation endpoints: - Generate Bearer Token
📁 URL Generation
Main API endpoints for generating encrypted URLs: - Generate Encrypted URL
📁 GTM Injectable API
Special endpoint for GTM scripts: - Generate Encrypted Seatmap URL
Usage Workflow
Step 1: Generate Bearer Token
- Select the appropriate "Generate Bearer Token" request for your brand
- Click "Send"
- The response will contain a bearer token
- 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 URLs
- Modify the request body with your PNR and passenger details:
json { "pnr": "YOUR_PNR", "last_name": "PASSENGER_LASTNAME", "source": "api", } - Click "Send"
- The response will contain encrypted URLs for seatmap, cart, and checkout
Example Response:
{
"success": true,
"encrypted_id": "encrypted_booking_id_here",
"seatmap_url": "https://departcart.com/seatmap?id=encrypted_id&source=api",
"cart_url": "https://departcart.com/cart?id=encrypted_id",
"checkout_url": "https://departcart.com/checkout?id=encrypted_id",
"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 /generate-encrypted-url
Generates encrypted URLs for seatmap, cart, and checkout pages.
Headers:
Authorization: Bearer {your_bearer_token}
Content-Type: application/json
Request Body:
{
"pnr": "BOOKING_REFERENCE",
"last_name": "PASSENGER_LASTNAME",
"source": "api",
}
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
- Ensure the brand matches your authentication credentials
Connection Errors
- Verify the Flask application is running
- Check the
base_urlenvironment 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.