meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
api [2025/11/28 16:22] – API revision as of 28 NOV 25 47.54.102.121api [2026/09/10 16:47] (current) – link to developer.itflow.org wrongecho
Line 1: Line 1:
 ====== API ====== ====== API ======
  
- +Use ITFlow's API to work with ITFlow in scripts and third-party applications.
-Use ITFlow's API to work with ITFlow in scripts third-party applications.+
  
 The current version of the ITFlow API is v1. It can be accessed at **itflow.example.com/api/v1/{module}/{function}.php** The current version of the ITFlow API is v1. It can be accessed at **itflow.example.com/api/v1/{module}/{function}.php**
  
-===== Generating an API Key ===== +We are in the process of creating dedicated API documentation accessible at: [[https://developer.itflow.org]]
- +
-  - Login and navigate to the **Admin Settings** page +
-  - Select **API Keys** +
-  - Select **Create** to open the New Key modal +
-  - On Details tab, input the key name and expiration date. Select whether the key will allow access to all clients or a specific client +
-  - On Keys tab, note down the API key and credential password and select the checkbox to confirm you've made a copy of the keys. You will not see these admin in the admin interface. +
-  - Select Create to add the key into the database +
- +
-===== Modules with API support at present ===== +
- +
-  * assets +
-  * certificates +
-  * clients +
-  * contacts +
-  * credentials (logins) +
-  * documents +
-  * domains +
-  * expenses +
-  * invoices +
-  * locations +
-  * networks +
-  * payments +
-  * products +
-  * quotes +
-  * software +
-  * tickets +
-  * vendors +
- +
- +
-===== API Functions ===== +
- +
-  * read +
-  * create //(partial)// +
-  * update //(partial)// +
-  * delete //(partial)// +
- +
- +
-  * //We may also add archive// +
- +
-===== Request Methods ===== +
- +
-  * GET - Retrieving (READ) data +
-  * POST - Inserting (CREATE), Updating (UPDATE) or Deleting (DELETE) data +
- +
-==== Data Returned ==== +
- +
-  * Success - True/False +
-  * Message - Failure info / Helpful debug info +
-  * Count - Count of rows affected/returned +
-  * Data - The data requested/created/changed +
- +
- +
-==== Notes ==== +
- +
-  * For read requests, 50 records are shown by default. This can be adjusted by supplying the ''limit'' and ''offset'' parameters. +
-  * For POST requests, the ''client_id'' parameter is always required if the API key used has scope/access to all clients +
-  * Be sure to check your Apache/PHP error logs if you're running into issues +
- +
-==== API Docs/Examples ==== +
- +
-Documentation / an example of how to use a module API endpoint is shown on that module's doc page. Additional examples are available [[https://github.com/itflow-org/itflow-api-powershell|here]]+
- +
- +
- +
----- +
- +
- +
-====== API ====== +
- +
-Use ITFlow's API to work with ITFlow in scripts and third-party applications. +
- +
-The current version of the ITFlow API is v1. It can be accessed at **itflow.example.com/api/v1/{module}/{function}.php**+
  
 ===== Generating an API Key ===== ===== Generating an API Key =====
Line 100: Line 27:
   * expenses   * expenses
   * invoices   * invoices
 +  * invoice_items
   * locations   * locations
   * networks   * networks
Line 136: Line 64:
   * For POST requests, the ''client_id'' parameter is always required if the API key used has scope/access to all clients   * For POST requests, the ''client_id'' parameter is always required if the API key used has scope/access to all clients
   * Be sure to check your Apache/PHP error logs if you're running into issues   * Be sure to check your Apache/PHP error logs if you're running into issues
 +  * To prevent your server from accidentally logging API keys, see [[api_apache-logging|here]]
  
 ---- ----
Line 611: Line 540:
  
 ---- ----
 +
 +===== Invoice Items ''/api/v1/invoice_items/'' =====
 +
 +**Purpose**: Retrieve line items associated with invoices
 +
 +**Available Endpoints**:
 +  * ''GET /read.php'' - List/get invoice line items
 +
 +==== Read Parameters (GET) ====
 +
 +^ Parameter ^ Type ^ Description ^
 +| invoice_id | integer | Filter items by invoice ID |
 +| item_id | integer | Get a specific line item by ID |
 +
 +==== Response Fields ====
 +
 +^ Field ^ Type ^ Description ^
 +| item_id | integer | Unique line item ID |
 +| item_name | string | Name/title of the line item |
 +| item_description | string | Description or notes |
 +| item_quantity | decimal | Quantity billed |
 +| item_price | decimal | Unit price |
 +| item_subtotal | decimal | quantity × price |
 +| item_tax | decimal | Tax amount applied |
 +| item_total | decimal | subtotal + tax |
 +| item_order | integer | Display sort order |
 +| item_tax_id | integer | Associated tax rate ID (0 = no tax) |
 +| item_product_id | integer | Associated product ID (0 = ad-hoc item) |
 +| item_invoice_id | integer | Parent invoice ID |
 +| item_created_at | datetime | Record creation timestamp |
 +| item_updated_at | datetime | Last update timestamp |
 +| item_archived_at | datetime | Archive timestamp (null if active) |
 +
 +==== Example - Get all items for an invoice ====
 +
 +<code bash>
 +curl "https://itflow.example.com/api/v1/invoice_items/read.php?api_key=YOUR_KEY&invoice_id=101"
 +</code>
 +
 +==== Example Response ====
 +
 +<code json>
 +{
 +  "success": "True",
 +  "count": 2,
 +  "data": [
 +    {
 +      "item_id": "184",
 +      "item_name": "make pizza",
 +      "item_description": "Do it",
 +      "item_quantity": "1.00",
 +      "item_price": "100.00",
 +      "item_subtotal": "100.00",
 +      "item_tax": "0.00",
 +      "item_total": "100.00",
 +      "item_order": "1",
 +      "item_tax_id": "0",
 +      "item_product_id": "0",
 +      "item_invoice_id": "101",
 +      "item_created_at": "2026-03-10 13:11:30",
 +      "item_updated_at": null,
 +      "item_archived_at": null
 +    }
 +  ]
 +}
 +</code>
  
 ==== Locations ''/api/v1/locations/'' ==== ==== Locations ''/api/v1/locations/'' ====
Line 971: Line 966:
 | Expenses | ✓ | - | - | - | - | - | | Expenses | ✓ | - | - | - | - | - |
 | Invoices | ✓ | - | - | - | - | - | | Invoices | ✓ | - | - | - | - | - |
 +| [[#invoice_items_api_v1_invoice_items|Invoice Items]] | ✓ | - | - | - | - | - |
 | Locations | ✓ | ✓ | - | - | - | - | | Locations | ✓ | ✓ | - | - | - | - |
 | Networks | ✓ | - | - | - | - | - | | Networks | ✓ | - | - | - | - | - |