{% extends "base.html" %} {% block title %}API Documentation - Project Ploughshares{% endblock %} {% block content %}
GET /api/transactions
curl -X GET "http://{{ server_name }}/api/transactions"
[
{
"id": 1,
"transaction_type": "Purchase Order",
"company_division": "Test Corp",
"amount": "1000.00",
"recipient": "Test Recipient",
"description": "Test transaction",
"approved": false,
"created_at": "2025-07-23T22:43:35.520130"
}
]
GET /api/transaction/{id}
curl -X GET "http://{{ server_name }}/api/transaction/1"
{
"navigation": {
"next_id": null,
"prev_id": null
},
"transaction": {
"id": 1,
"transaction_type": "Purchase Order",
"company_division": "Test Corp",
"address_1": "",
"address_2": "",
"city": "",
"province": "",
"region": "",
"postal_code": "",
"is_primary": false,
"source_date": null,
"source_description": "",
"grant_type": "",
"description": "Test transaction",
"amount": "1000.00",
"recipient": "Test Recipient",
"commodity_class": "",
"contract_number": "",
"comments": "",
"approved": false,
"approved_at": null,
"approved_by": null,
"created_at": "2025-07-23T22:43:35.520130"
}
}
POST /api/transaction
Note: All transactions created via API are set to "pending approval" status by default. They must be explicitly approved using the approval endpoint before being considered valid.
transaction_type
- Type of transaction (e.g., "Purchase Order", "Subcontract")company_division
- Company or division namerecipient
- Recipient of the transactionamount
- Transaction amount (defaults to 0)description
- Transaction descriptionaddress_1
, address_2
, city
, province
, region
, postal_code
- Address fieldssource_date
- Date in YYYY-MM-DD formatsource_description
- Source descriptiongrant_type
- Type of grantcommodity_class
- Commodity classificationcontract_number
- Contract numbercomments
- Additional commentsis_primary
- Boolean flag (defaults to false)curl -X POST "http://{{ server_name }}/api/transaction" \
-H "Content-Type: application/json" \
-d '{
"transaction_type": "Purchase Order",
"company_division": "Example Corp",
"recipient": "Test Recipient",
"amount": 1000.00,
"description": "Test transaction"
}'
{
"message": "Transaction created successfully and is pending approval",
"transaction_id": 2
}
PUT /api/transaction/{id}
Note: This endpoint only updates transaction details. It does not change the approval status of a transaction. To approve a transaction, use the dedicated approval endpoint.
curl -X PUT "http://{{ server_name }}/api/transaction/2" \
-H "Content-Type: application/json" \
-d '{
"transaction_type": "Purchase Order",
"company_division": "Updated Corp",
"description": "Updated transaction",
"amount": 1500.00,
"recipient": "Updated Recipient"
}'
{
"message": "Transaction updated successfully"
}
DELETE /api/transaction/{id}
curl -X DELETE "http://{{ server_name }}/api/transaction/3"
{
"message": "Transaction deleted successfully"
}
GET /api/transactions/pending
curl -X GET "http://{{ server_name }}/api/transactions/pending"
[
{
"id": 1,
"transaction_type": "Purchase Order",
"company_division": "Test Corp",
"amount": "1000.00",
"recipient": "Test Recipient",
"description": "Test transaction",
"approved": false,
"created_at": "2025-07-23T22:43:35.520130"
}
]
POST /api/transaction/{id}/approve
Important: This endpoint provides human-in-the-loop verification. All transactions (especially those created via API) require explicit approval before being considered valid. The system automatically records the approval with a standard identifier.
curl -X POST "http://{{ server_name }}/api/transaction/2/approve"
{
"message": "Transaction approved successfully"
}