Spend Data Integration
Learn how to send spend data to Rampart
This is section is still under active development and not all endpoints are available yet.
Rampart provides two methods for sending spend data: direct API integration and file upload. This guide explains both approaches and their requirements.
Overview
You can send spend data to Rampart in two ways:
- Direct API integration for programmatic data submission
- File upload for bulk data processing
Base URL Configuration
The Rampart API base URL is https://api.rampartcorporation.com
All API endpoints should be prefixed with this base URL.
Direct API Integration
Endpoint
Headers
Request Body Structure
Response
File Upload Integration
Endpoint
Headers
Request Body
- File field name:
file
- Supported formats: CSV, XLSX
- Maximum file size: 10MB
Response
Required Data Fields
Purchase Orders & Invoices
- Vendor name
- Order date
- SKU numbers
- Item names
- Price paid
- Quantity bought
- Unit
Credit Card Transactions
- Vendor name
- Order date
- Amount (excluding taxes ideally)
Implementation Steps
-
Direct API Integration
- Format your spend data according to the request structure
- Send a POST request to
/developer/v1/spends
- Include your
RAMPART_SECRET_TOKEN
in the Authorization header - Process the response to track spend and savings IDs
-
File Upload Integration
- Prepare your CSV or XLSX file with the required fields
- Create a FormData object with the file
- Send a POST request to
/developer/v1/spends/upload
- Include your
RAMPART_SECRET_TOKEN
in the Authorization header - Process the response to confirm successful upload
Best Practices
Data Validation
- Ensure all required fields are present
- Validate data types and formats
- Check for duplicate entries
- Verify numerical values are positive
Error Handling
- Implement proper error handling for failed requests
- Validate file formats before upload
- Check file size limits
- Handle network errors gracefully
Security
- Never expose your secret token in client-side code
- Always use HTTPS in production
- Store tokens securely in environment variables
- Implement proper access controls
Example Usage
Direct API Integration
File Upload
Common Issues
Invalid Data Format
- Ensure all required fields are present
- Verify data types match the expected format
- Check for proper date formatting
- Validate numerical values
File Upload Issues
- Check file size limits
- Verify file format (CSV or XLSX)
- Ensure proper file encoding
- Validate file content structure
Authentication Failures
- Verify your
RAMPART_SECRET_TOKEN
is valid - Check environment settings
- Ensure proper headers are included