REST API Reference
Pull invoice data from TaprNext via REST API for integration with your systems.
Authentication
Section titled “Authentication”API Key
Section titled “API Key”Generate an API key by navigating to Settings > API Keys, clicking Generate Key, and securely storing the credentials. Include authentication in requests using:
Authorization: token api_key:api_secretOAuth 2.0
Section titled “OAuth 2.0”For OAuth applications, register your app in Settings > OAuth Apps, implement the OAuth 2.0 flow, and use the access token in requests.
Base URL
Section titled “Base URL”https://your-site.tapr.ch/api/Available Endpoints
Section titled “Available Endpoints”List Approved Invoices
Section titled “List Approved Invoices”GET /api/resource/Purchase InvoiceSupported query parameters include filters for JSON conditions, fields to specify returned data, limit_page_length for results per page, limit_start for pagination offset, and order_by for sorting.
Example request retrieves invoices filtered by approval status with specified fields like vendor and total amount.
Get Invoice Details
Section titled “Get Invoice Details”GET /api/resource/Purchase Invoice/{name}Returns full invoice information including items, taxes, and metadata.
Mark Invoice as Posted
Section titled “Mark Invoice as Posted”PUT /api/resource/Purchase Invoice/{name}Update status after posting to your ERP system with fields like erp_reference, erp_posting_date, and erp_posting_status.
Additional Endpoints
Section titled “Additional Endpoints”GET /api/resource/Vendor- Retrieve vendor informationGET /api/resource/Purchase Order- Access purchase orders with optional status filtering
Filtering
Section titled “Filtering”Filter Syntax
Section titled “Filter Syntax”Filters use the format: [["field", "operator", "value"]]
Operators include: = (equals), != (not equals), >, < (comparison), >=, <= (inclusive comparison), like (contains with % wildcard), in (list membership), and between (range).
Filter Examples
Section titled “Filter Examples”- Approved invoices exceeding €1000:
[["status","=","Approved"],["grand_total",">",1000]] - Invoices from specific vendor:
[["vendor","=","Acme Corp"]] - Date range filtering:
[["posting_date",">=","2024-01-01"],["posting_date","<=","2024-01-31"]]
Pagination
Section titled “Pagination”For large result sets, use limit_page_length=20&limit_start=0 for the first page, incrementing limit_start by 20 for subsequent pages.
Rate Limits
Section titled “Rate Limits”- Requests per minute: 100
- Burst (per second): 20
- Response timeout: 30 seconds
Response headers include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.
Sample Integration Code
Section titled “Sample Integration Code”Python
Section titled “Python”import requests
API_BASE = "https://your-site.tapr.ch/api"API_KEY = "api_key:api_secret"
def get_approved_invoices(): response = requests.get( f"{API_BASE}/resource/Purchase Invoice", headers={"Authorization": f"token {API_KEY}"}, params={ "filters": '[["status","=","Approved"]]', "fields": '["name","vendor","grand_total","items"]' } ) return response.json()["data"]
def mark_as_posted(invoice_name, erp_reference): response = requests.put( f"{API_BASE}/resource/Purchase Invoice/{invoice_name}", headers={"Authorization": f"token {API_KEY}"}, json={ "erp_reference": erp_reference, "erp_posting_status": "Posted" } ) return response.status_code == 200Node.js
Section titled “Node.js”const axios = require('axios');
const API_BASE = 'https://your-site.tapr.ch/api';const API_KEY = 'api_key:api_secret';
async function getApprovedInvoices() { const response = await axios.get( `${API_BASE}/resource/Purchase Invoice`, { headers: { Authorization: `token ${API_KEY}` }, params: { filters: JSON.stringify([['status', '=', 'Approved']]), fields: JSON.stringify(['name', 'vendor', 'grand_total']) } } ); return response.data.data;}Best Practices
Section titled “Best Practices”- Poll efficiently to avoid unnecessary requests
- Use filters to retrieve only required data
- Implement pagination for large datasets
- Apply exponential backoff for retry logic
- Update invoice status after successful ERP posting