meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| api [2024/02/10 12:14] – add clients wrongecho | api [2025/11/28 16:22] (current) – API revision as of 28 NOV 25 47.54.102.121 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | Use ITFlow' | + | Use ITFlow' |
| - | The current version of the ITFlow API is v1. It can be accessed at **/ | + | The current version of the ITFlow API is v1. It can be accessed at **itflow.example.com/ |
| + | |||
| + | ===== Generating an API Key ===== | ||
| + | |||
| + | - 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 ===== | ===== Modules with API support at present ===== | ||
| Line 12: | Line 21: | ||
| * clients | * clients | ||
| * contacts | * contacts | ||
| + | * credentials (logins) | ||
| + | * documents | ||
| * domains | * domains | ||
| + | * expenses | ||
| + | * invoices | ||
| + | * locations | ||
| * networks | * networks | ||
| + | * payments | ||
| + | * products | ||
| + | * quotes | ||
| * software | * software | ||
| * tickets | * tickets | ||
| + | * vendors | ||
| Line 23: | Line 41: | ||
| * create // | * create // | ||
| * update // | * update // | ||
| - | ===== Generating an API Key ===== | + | * delete // |
| - | - Navigate to the **Admin** panel | ||
| - | - Click on **API** | ||
| - | - Click on **New Key** to generate a new key | ||
| + | * //We may also add archive// | ||
| ===== Request Methods ===== | ===== Request Methods ===== | ||
| Line 45: | Line 61: | ||
| ==== Notes ==== | ==== Notes ==== | ||
| - | * For read requests, 50 records are shown by default. This can be adjusted by supplying the limit and offset parameters. | + | * For read requests, 50 records are shown by default. This can be adjusted by supplying the '' |
| - | * For POST requests, the client_id parameter is always required if the API key used has scope/ | + | * For POST requests, the '' |
| * 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 | ||
| Line 53: | Line 69: | ||
| Documentation / an example of how to use a module API endpoint is shown on that module' | Documentation / an example of how to use a module API endpoint is shown on that module' | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ====== API ====== | ||
| + | |||
| + | Use ITFlow' | ||
| + | |||
| + | The current version of the ITFlow API is v1. It can be accessed at **itflow.example.com/ | ||
| + | |||
| + | ===== Generating an API Key ===== | ||
| + | |||
| + | - 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 again in the admin interface. | ||
| + | - Select Create to add the key into the database | ||
| + | |||
| + | ===== Modules with API support ===== | ||
| + | |||
| + | * assets | ||
| + | * certificates | ||
| + | * clients | ||
| + | * contacts | ||
| + | * credentials (logins) | ||
| + | * documents | ||
| + | * domains | ||
| + | * expenses | ||
| + | * invoices | ||
| + | * locations | ||
| + | * networks | ||
| + | * payments | ||
| + | * products | ||
| + | * quotes | ||
| + | * software | ||
| + | * tickets | ||
| + | * vendors | ||
| + | |||
| + | ===== API Functions ===== | ||
| + | |||
| + | * read | ||
| + | * create //(partial - see module details)// | ||
| + | * update //(partial - see module details)// | ||
| + | * delete //(partial - see module details)// | ||
| + | * archive //(clients and contacts only)// | ||
| + | * unarchive //(clients and contacts only)// | ||
| + | * resolve //(tickets only)// | ||
| + | |||
| + | ===== Request Methods ===== | ||
| + | |||
| + | * GET - Retrieving (READ) data | ||
| + | * POST - Inserting (CREATE), Updating (UPDATE), Deleting (DELETE), or Archiving data | ||
| + | |||
| + | ==== Data Returned ==== | ||
| + | |||
| + | * Success - True/False | ||
| + | * Message - Failure info / Helpful debug info | ||
| + | * Count - Count of rows affected/ | ||
| + | * Data - The data requested/ | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | * For read requests, 50 records are shown by default. This can be adjusted by supplying the '' | ||
| + | * For POST requests, the '' | ||
| + | * Be sure to check your Apache/PHP error logs if you're running into issues | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== API Reference Guide ====== | ||
| + | |||
| + | **Current API v1 Endpoints, Authentication, | ||
| + | |||
| + | ===== Quick Start Guide ===== | ||
| + | |||
| + | ==== Your First API Call in 5 Minutes ==== | ||
| + | |||
| + | - **Generate API Key** | ||
| + | - Login to ITFlow as admin | ||
| + | - Navigate to **Admin > API** | ||
| + | - Click **New Key** | ||
| + | - Choose scope: **All Clients** (for testing) or **Specific Client** | ||
| + | - Copy the generated key | ||
| + | |||
| + | - **Test Connection** | ||
| + | <code bash> | ||
| + | curl " | ||
| + | </ | ||
| + | |||
| + | - **Expected Response** | ||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== API Overview ===== | ||
| + | |||
| + | * **Base URL**: ''/ | ||
| + | * **Version**: | ||
| + | * **Authentication**: | ||
| + | * **Response Format**: JSON with '' | ||
| + | * **Pagination**: | ||
| + | * **Content-Type**: | ||
| + | * **Character Encoding**: UTF-8 (utf8mb4 in database) | ||
| + | |||
| + | ==== Standard Response Format ==== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Create Response Format ==== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Authentication & Security ===== | ||
| + | |||
| + | ==== API Key Management ==== | ||
| + | |||
| + | * **Generation**: | ||
| + | * **Scoping Options**: | ||
| + | * **All Clients** (client_id = 0): Full access to all client data | ||
| + | * **Specific Client**: Limited to single client data only | ||
| + | * **Usage**: Query parameter ''? | ||
| + | * **Security**: | ||
| + | |||
| + | ==== Best Practices ==== | ||
| + | |||
| + | * **Rotate keys** regularly (monthly recommended) | ||
| + | * **Use client-scoped keys** for third-party integrations | ||
| + | * **Store keys securely** (environment variables, not code) | ||
| + | * **Monitor usage** via Apache/PHP logs | ||
| + | * **Use HTTPS only** for all API calls | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Module Reference ===== | ||
| + | |||
| + | ==== Assets ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | asset_id | integer | Get specific asset by ID | | ||
| + | | asset_type | string | Filter by asset type (auto-capitalized) | | ||
| + | | asset_name | string | Filter by exact asset name | | ||
| + | | asset_serial | string | Filter by serial number | | ||
| + | | asset_mac | string | Filter by MAC address (searches primary interface) | | ||
| + | | asset_uri | string | Filter by URI | | ||
| + | |||
| + | **Create/ | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required (Create) ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | asset_name | string | Yes | Asset name/ | ||
| + | | asset_description | string | No | Asset description | | ||
| + | | asset_type | string | No | Type (Laptop, Desktop, Server, etc.) | | ||
| + | | asset_make | string | No | Manufacturer | | ||
| + | | asset_model | string | No | Model name/number | | ||
| + | | asset_serial | string | No | Serial number | | ||
| + | | asset_os | string | No | Operating system | | ||
| + | | asset_ip | string | No | IP address (stored in primary interface) | | ||
| + | | asset_mac | string | No | MAC address (stored in primary interface) | | ||
| + | | asset_uri | string | No | Management URL | | ||
| + | | asset_status | string | No | Status (Deployed, Spare, etc.) | | ||
| + | | asset_purchase_date | date | No | Purchase date (YYYY-MM-DD) | | ||
| + | | asset_warranty_expire | date | No | Warranty expiration date | | ||
| + | | asset_install_date | date | No | Installation date | | ||
| + | | asset_notes | string | No | Notes | | ||
| + | | asset_vendor_id | integer | No | Associated vendor ID | | ||
| + | | asset_location_id | integer | No | Associated location ID | | ||
| + | | asset_contact_id | integer | No | Associated contact ID | | ||
| + | | asset_network_id | integer | No | Network ID for primary interface | | ||
| + | |||
| + | **Update Additional Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | asset_id | integer | Yes | ID of asset to update | | ||
| + | |||
| + | **Delete Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | asset_id | integer | Yes | ID of asset to delete | | ||
| + | |||
| + | <wrap em>Note: Deleting an asset also removes all associated network interfaces.</ | ||
| + | |||
| + | **Example - Create Asset**: | ||
| + | |||
| + | <code bash> | ||
| + | curl -X POST " | ||
| + | -H " | ||
| + | -d '{ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Certificates ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Update and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | certificate_id | integer | Get specific certificate by ID | | ||
| + | | certificate_name | string | Filter by certificate name | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | certificate_name | string | Yes | Certificate friendly name | | ||
| + | | certificate_domain | string | Yes | Domain the certificate covers | | ||
| + | | certificate_description | string | No | Description | | ||
| + | | certificate_issued_by | string | No | Issuing authority (e.g., Let's Encrypt) | | ||
| + | | certificate_expire | date | No | Expiration date (YYYY-MM-DD) | | ||
| + | | certificate_public_key | string | No | Certificate content/ | ||
| + | | certificate_notes | string | No | Additional notes | | ||
| + | | certificate_domain_id | integer | No | Link to domains table | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Clients ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Delete endpoint is not implemented. Use archive instead.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | client_name | string | Get specific client by exact name | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | <wrap em> | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key (must be all-client scope) | | ||
| + | | client_name | string | Yes | Client/ | ||
| + | | client_type | string | No | Business type/ | ||
| + | | client_website | string | No | Website URL (https:// prefix auto-removed) | | ||
| + | | client_referral | string | No | Referral source | | ||
| + | | client_rate | decimal | No | Hourly rate | | ||
| + | | client_currency_code | string | No | Currency code (e.g., USD) | | ||
| + | | client_net_terms | integer | No | Payment terms in days | | ||
| + | | client_tax_id_number | string | No | Tax ID/EIN | | ||
| + | | client_abbreviation | string | No | Short code (max 6 chars) | | ||
| + | | client_is_lead | integer | No | Lead flag (0 or 1) | | ||
| + | | client_notes | string | No | Additional notes | | ||
| + | |||
| + | **Update Additional Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | client_id | integer | Yes | ID of client to update | | ||
| + | |||
| + | **Archive/ | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | client_id | integer | Yes | ID of client (from API key scope) | | ||
| + | |||
| + | <wrap em>Note: Archiving a client automatically stops all recurring invoices for that client.</ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Contacts ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | contact_id | integer | Get specific contact by ID | | ||
| + | | contact_email | string | Get contact by email address | | ||
| + | | contact_phone_or_mobile | string | Get contact by phone or mobile number | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | contact_name | string | Yes | Full name | | ||
| + | | contact_email | string | Yes | Email address (must be unique per client) | | ||
| + | | contact_title | string | No | Job title | | ||
| + | | contact_department | string | No | Department | | ||
| + | | contact_phone | string | No | Phone number (non-digits stripped) | | ||
| + | | contact_extension | string | No | Phone extension | | ||
| + | | contact_mobile | string | No | Mobile number (non-digits stripped) | | ||
| + | | contact_notes | string | No | Notes | | ||
| + | | contact_primary | integer | No | Primary contact flag (0 or 1) | | ||
| + | | contact_important | integer | No | Important flag (0 or 1) | | ||
| + | | contact_billing | integer | No | Billing contact flag (0 or 1) | | ||
| + | | contact_technical | integer | No | Technical contact flag (0 or 1) | | ||
| + | | contact_location_id | integer | No | Associated location ID | | ||
| + | |||
| + | <wrap em>Note: Setting contact_primary = 1 will remove primary flag from other contacts for that client.</ | ||
| + | |||
| + | **Update Additional Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | contact_id | integer | Yes | ID of contact to update | | ||
| + | |||
| + | **Delete Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | contact_id | integer | Yes | ID of contact to delete | | ||
| + | |||
| + | **Archive/ | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | contact_id | integer | Yes | ID of contact to archive/ | ||
| + | |||
| + | <wrap em>Note: Archiving a contact also archives their associated user account if one exists.</ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Credentials ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Delete endpoint is not implemented.</ | ||
| + | |||
| + | <wrap em> | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key_decrypt_password | string | Yes | Decryption password for the API key | | ||
| + | | credential_id | integer | No | Get specific credential by ID | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | api_key_decrypt_password | string | Yes | Decryption password | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | credential_name | string | Yes | Credential name/label | | ||
| + | | credential_password | string | Yes | Password (will be encrypted) | | ||
| + | | credential_description | string | No | Description | | ||
| + | | credential_uri | string | No | Login URL | | ||
| + | | credential_uri_2 | string | No | Secondary URL | | ||
| + | | credential_username | string | No | Username (will be encrypted) | | ||
| + | | credential_otp_secret | string | No | TOTP/2FA secret | | ||
| + | | credential_note | string | No | Additional notes | | ||
| + | | credential_important | integer | No | Important flag (0 or 1) | | ||
| + | | credential_contact_id | integer | No | Associated contact ID | | ||
| + | | credential_vendor_id | integer | No | Associated vendor ID | | ||
| + | | credential_asset_id | integer | No | Associated asset ID | | ||
| + | | credential_software_id | integer | No | Associated software ID | | ||
| + | |||
| + | **Update Additional Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | credential_id | integer | Yes | ID of credential to update | | ||
| + | | api_key_decrypt_password | string | Yes | Decryption password | | ||
| + | |||
| + | <wrap em>Note: Updating the password field automatically updates the password_changed_at timestamp.</ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Documents ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Delete endpoint is not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | document_id | integer | Get specific document by ID | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | document_name | string | Yes | Document title | | ||
| + | | document_content | string | Yes | Document content (HTML supported) | | ||
| + | | document_description | string | No | Brief description | | ||
| + | | document_folder_id | integer | No | Folder ID for organization | | ||
| + | |||
| + | **Update Additional Parameters**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | document_id | integer | Yes | ID of document to update | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Domains ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | domain_id | integer | Get specific domain by ID | | ||
| + | | domain_name | string | Get domain by exact name | | ||
| + | |||
| + | **Response Fields**: | ||
| + | |||
| + | ^ Field ^ Type ^ Description ^ | ||
| + | | domain_id | integer | Primary key | | ||
| + | | domain_name | string | Domain name | | ||
| + | | domain_description | string | Description | | ||
| + | | domain_expire | date | Expiration date | | ||
| + | | domain_ip | string | IP address(es) | | ||
| + | | domain_name_servers | string | Name servers | | ||
| + | | domain_mail_servers | string | MX records | | ||
| + | | domain_txt | string | TXT records | | ||
| + | | domain_raw_whois | string | Raw WHOIS data | | ||
| + | | domain_notes | string | Notes | | ||
| + | | domain_registrar | integer | Registrar vendor ID | | ||
| + | | domain_webhost | integer | Web host vendor ID | | ||
| + | | domain_dnshost | integer | DNS host vendor ID | | ||
| + | | domain_mailhost | integer | Mail host vendor ID | | ||
| + | | domain_client_id | integer | Client ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Expenses ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | <wrap em> | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | expense_id | integer | Get specific expense by ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Invoices ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | invoice_id | integer | Get specific invoice by ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Locations ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Update and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | location_id | integer | Get specific location by ID | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | Yes* | Required if API key has all-client access | | ||
| + | | location_name | string | Yes | Location name | | ||
| + | | location_description | string | No | Description | | ||
| + | | location_country | string | No | Country | | ||
| + | | location_address | string | No | Street address | | ||
| + | | location_city | string | No | City | | ||
| + | | location_state | string | No | State/ | ||
| + | | location_zip | string | No | ZIP/postal code | | ||
| + | | location_hours | string | No | Business hours | | ||
| + | | location_notes | string | No | Notes | | ||
| + | | location_primary | integer | No | Primary location flag (0 or 1) | | ||
| + | |||
| + | <wrap em>Note: Setting location_primary = 1 will remove primary flag from other locations for that client.</ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Networks ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | network_id | integer | Get specific network by ID | | ||
| + | | network_name | string | Get network by exact name | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Payments ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | <wrap em> | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | payment_id | integer | Get specific payment by ID | | ||
| + | | payment_invoice_id | integer | Get all payments for an invoice | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Products ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | <wrap em> | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | product_id | integer | Get specific product by ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Quotes ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | quote_id | integer | Get specific quote by ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Software ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | software_id | integer | Get specific software by ID | | ||
| + | | software_name | string | Get by exact name | | ||
| + | | software_type | string | Filter by type | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Tickets ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Update and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | ticket_id | integer | Get specific ticket by ID (includes status information) | | ||
| + | |||
| + | **Create Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | api_key | string | Yes | API authentication key | | ||
| + | | client_id | integer | No | Client ID (defaults to 0 if not provided) | | ||
| + | | ticket_subject | string | Yes | Ticket subject/ | ||
| + | | ticket_details | string | No | Ticket description | | ||
| + | | ticket_priority | string | No | Priority (Low, Medium, High) - defaults to " | ||
| + | | ticket_contact_id | integer | No | Contact ID (auto-selects primary contact if not provided) | | ||
| + | | ticket_asset_id | integer | No | Related asset ID | | ||
| + | | ticket_vendor_id | integer | No | Escalation vendor ID | | ||
| + | | ticket_vendor_ticket_id | integer | No | Vendor' | ||
| + | | ticket_assigned_to | integer | No | Assigned user ID | | ||
| + | | ticket_billable | integer | No | Billable flag (0 or 1) | | ||
| + | |||
| + | <wrap em>Note: Ticket number is auto-generated based on system settings. Ticket source is set to " | ||
| + | |||
| + | **Resolve Parameters (POST)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Required ^ Description ^ | ||
| + | | ticket_id | integer | Yes | ID of ticket to resolve | | ||
| + | |||
| + | <wrap em>Note: Resolving sets status to Resolved and records the resolution timestamp. Also sets first response time if not already set.</ | ||
| + | |||
| + | **Example - Create Ticket**: | ||
| + | |||
| + | <code bash> | ||
| + | curl -X POST " | ||
| + | -H " | ||
| + | -d '{ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Vendors ''/ | ||
| + | |||
| + | **Purpose**: | ||
| + | |||
| + | **Available Endpoints**: | ||
| + | |||
| + | * '' | ||
| + | |||
| + | <wrap em>Note: Create, update, and delete endpoints are not implemented.</ | ||
| + | |||
| + | **Read Parameters (GET)**: | ||
| + | |||
| + | ^ Parameter ^ Type ^ Description ^ | ||
| + | | vendor_id | integer | Get specific vendor by ID | | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Custom API Extensions ===== | ||
| + | |||
| + | **Location**: | ||
| + | |||
| + | ITFlow supports custom API endpoints. Place custom PHP files in the '' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Error Handling & Troubleshooting ===== | ||
| + | |||
| + | ==== HTTP Status Codes ==== | ||
| + | |||
| + | ^ Code ^ Description ^ | ||
| + | | 200 | Success - Request completed successfully | | ||
| + | | 401 | Unauthorized - Invalid or missing API key | | ||
| + | | 405 | Method Not Allowed - Only GET and POST supported | | ||
| + | |||
| + | ==== Common Error Messages ==== | ||
| + | |||
| + | ^ Message ^ Cause ^ | ||
| + | | " | ||
| + | | "No resource (for this client and company) with the specified parameter(s)." | ||
| + | | "Auth success but insert query failed..." | ||
| + | | "Auth success but update query failed..." | ||
| + | | "Auth success but delete query failed..." | ||
| + | |||
| + | ==== Troubleshooting Steps ==== | ||
| + | |||
| + | - **API Key Issues** | ||
| + | * Verify key is correct (copy/paste errors common) | ||
| + | * Check key scope (client-specific vs all clients) | ||
| + | * Confirm key hasn't expired | ||
| + | |||
| + | - **Permission Errors** | ||
| + | * Add '' | ||
| + | * Verify client_id exists and is accessible | ||
| + | |||
| + | - **Server Errors** | ||
| + | * Check Apache/PHP error logs: ''/ | ||
| + | * Verify ITFlow database connectivity | ||
| + | * Check PHP memory limits for large requests | ||
| + | |||
| + | - **Data Issues** | ||
| + | * Validate required fields for POST requests | ||
| + | * Check data types (strings, integers, dates) | ||
| + | * Verify foreign key relationships exist | ||
| + | * Ensure unique constraints aren't violated (e.g., contact email per client) | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Integration Examples ===== | ||
| + | |||
| + | ==== PowerShell ==== | ||
| + | |||
| + | **List All Clients**: | ||
| + | |||
| + | <code powershell> | ||
| + | $apiKey = " | ||
| + | $baseUrl = " | ||
| + | $uri = " | ||
| + | |||
| + | Invoke-RestMethod -Uri $uri | ConvertTo-Json | ||
| + | </ | ||
| + | |||
| + | **Create New Asset**: | ||
| + | |||
| + | <code powershell> | ||
| + | $uri = " | ||
| + | $body = @{ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ConvertTo-Json | ||
| + | |||
| + | Invoke-RestMethod -Method Post -Uri $uri -Body $body -ContentType " | ||
| + | </ | ||
| + | |||
| + | ==== Python ==== | ||
| + | |||
| + | <code python> | ||
| + | import requests | ||
| + | |||
| + | api_key = " | ||
| + | base_url = " | ||
| + | |||
| + | # Get all clients | ||
| + | response = requests.get(f" | ||
| + | data = response.json() | ||
| + | print(data) | ||
| + | |||
| + | # Create new ticket | ||
| + | ticket_data = { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | |||
| + | response = requests.post(f" | ||
| + | result = response.json() | ||
| + | print(result) | ||
| + | </ | ||
| + | |||
| + | ==== PHP ==== | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | $api_key = ' | ||
| + | $base_url = ' | ||
| + | |||
| + | // Get clients | ||
| + | $url = $base_url . ' | ||
| + | $response = file_get_contents($url); | ||
| + | $data = json_decode($response, | ||
| + | |||
| + | print_r($data); | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | ==== cURL ==== | ||
| + | |||
| + | <code bash> | ||
| + | # Get all assets for a client | ||
| + | curl " | ||
| + | |||
| + | # Create a contact | ||
| + | curl -X POST " | ||
| + | -H " | ||
| + | -d '{ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== API Module Summary ===== | ||
| + | |||
| + | ^ Module ^ Read ^ Create ^ Update ^ Delete ^ Archive ^ Other ^ | ||
| + | | Assets | ✓ | ✓ | ✓ | ✓ | - | - | | ||
| + | | Certificates | ✓ | ✓ | - | - | - | - | | ||
| + | | Clients | ✓ | ✓ | ✓ | - | ✓ | unarchive | | ||
| + | | Contacts | ✓ | ✓ | ✓ | ✓ | ✓ | unarchive | | ||
| + | | Credentials | ✓ | ✓ | ✓ | - | - | - | | ||
| + | | Documents | ✓ | ✓ | ✓ | - | - | - | | ||
| + | | Domains | ✓ | - | - | - | - | - | | ||
| + | | Expenses | ✓ | - | - | - | - | - | | ||
| + | | Invoices | ✓ | - | - | - | - | - | | ||
| + | | Locations | ✓ | ✓ | - | - | - | - | | ||
| + | | Networks | ✓ | - | - | - | - | - | | ||
| + | | Payments | ✓ | - | - | - | - | - | | ||
| + | | Products | ✓ | - | - | - | - | - | | ||
| + | | Quotes | ✓ | - | - | - | - | - | | ||
| + | | Software | ✓ | - | - | - | - | - | | ||
| + | | Tickets | ✓ | ✓ | - | - | - | resolve | | ||
| + | | Vendors | ✓ | - | - | - | - | - | | ||