et:api_direct
Erinevused
Siin näed erinevusi valitud versiooni ja hetkel kehtiva lehekülje vahel.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| et:api_direct [2026/07/07 10:31] – [Base URL & Versioning] toomas | et:api_direct [2026/10/21 08:16] (Hetkel kehtiv) – [📦 API Resources & Endpoints] toomas | ||
|---|---|---|---|
| Rida 10: | Rida 10: | ||
| * API key (obtain from your Directo administrator) | * API key (obtain from your Directo administrator) | ||
| * Basic understanding of REST APIs and HTTP methods | * Basic understanding of REST APIs and HTTP methods | ||
| - | * API Resources and Endpint can be found in Postman collection. Response field list managed in Directo ERP. Postman collection can be downloaded here: {{:et:toomas20260702-122402.json|POSTMAN}} | + | * API Resources and Endpint can be found in Postman collection. Response field list managed in Directo ERP. Postman collection can be downloaded here: [[:et:api_direct: |
| ==== Quick Start Guide ==== | ==== Quick Start Guide ==== | ||
| Rida 17: | Rida 17: | ||
| - **Choose Format**: Set the Accept header to application/ | - **Choose Format**: Set the Accept header to application/ | ||
| - **Make Your First Request**: Try the "All items" request to retrieve your item catalog | - **Make Your First Request**: Try the "All items" request to retrieve your item catalog | ||
| + | - **Call GET / | ||
| ==== Base URL & Versioning ==== | ==== Base URL & Versioning ==== | ||
| Rida 27: | Rida 28: | ||
| **Current Configuration: | **Current Configuration: | ||
| - | * **baseUrl**: | + | * **baseUrl**: |
| - | * **version**: | + | * **version**: |
| **Example Full URL:** | **Example Full URL:** | ||
| Rida 48: | Rida 49: | ||
| ==== Getting Your API Key ==== | ==== Getting Your API Key ==== | ||
| - | Contact | + | If your company doesn' |
| + | |||
| + | If a key has already been created, there' | ||
| ==== Security Best Practices ==== | ==== Security Best Practices ==== | ||
| Rida 89: | Rida 92: | ||
| </ | </ | ||
| + | ===== 🧭 API Discovery (openapi.json) ===== | ||
| + | |||
| + | Every API key has a machine-readable description of the API in OpenAPI 3.0 format: | ||
| + | |||
| + | <code bash> | ||
| + | curl -H " | ||
| + | | ||
| + | </ | ||
| + | |||
| + | The description is **key-specific**: | ||
| + | for that API key in Directo. If the key configuration changes, the description changes too. | ||
| + | |||
| + | ==== What the description contains ==== | ||
| + | |||
| + | ^ Section ^ Content ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | ==== Filter parameter naming ==== | ||
| + | |||
| + | ^ Prefix ^ Meaning ^ Example ^ | ||
| + | | (none) | Header / master record field | ''/ | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | **Note:** You can only filter by fields that are selected for output on the key. | ||
| + | Otherwise the API returns '' | ||
| + | The allowed filters are listed under '' | ||
| + | |||
| + | ==== How to use it ==== | ||
| + | |||
| + | * **Postman / Insomnia**: Import → Link. This generates a complete request collection automatically. | ||
| + | * **Swagger UI / Swagger Editor**: browse and test the API in a browser. | ||
| + | * **Code generators** (e.g. openapi-generator): | ||
| + | * **AI agents and MCP servers**: describe the available tools automatically. | ||
| + | |||
| + | <WRAP important> | ||
| + | The description shows which data can be retrieved with the key. Treat it with the same care | ||
| + | as the key itself: do not publish it, and always send the key in the header, never in the URL. | ||
| + | </ | ||
| ===== 🔍 Advanced Filtering (Key Feature) ===== | ===== 🔍 Advanced Filtering (Key Feature) ===== | ||
| Rida 303: | Rida 350: | ||
| < | < | ||
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| - | GET {{baseUrl}}/ | + | GET {{baseUrl}}/ |
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| + | GET {{baseUrl}}/ | ||
| </ | </ | ||
| + | This list is general. The resources available to your key are listed in openapi.json. | ||
| - | Postman collection can be downloaded here: e: {{:et:toomas20260702-122402.json|Directo API postman | + | Postman collection can be downloaded here: e: [[:et:api_direct:postman|POSTMAN]] |
| Rida 590: | Rida 645: | ||
| **Objective: | **Objective: | ||
| - | * **Step 1:** Fetch changed customers '' | + | * **Step 1:** Fetch changed customers '' |
| * **Step 2:** Sync to CRM (Create/ | * **Step 2:** Sync to CRM (Create/ | ||
| - | * **Step 3:** Fetch deleted customers '' | + | * **Step 3:** Fetch deleted customers '' |
| * **Step 4:** Remove deleted customers from CRM | * **Step 4:** Remove deleted customers from CRM | ||
| Rida 674: | Rida 729: | ||
| * Support for major resources: items, customers, orders, invoices, stock levels | * Support for major resources: items, customers, orders, invoices, stock levels | ||
| * JSON/XML support & ERP-style filtering | * JSON/XML support & ERP-style filtering | ||
| + | * added API discovery (openapi.json) 23.09.2026 | ||
| ===== 🔒 Security & Compliance ===== | ===== 🔒 Security & Compliance ===== | ||
| Rida 715: | Rida 771: | ||
| * **Tip 2:** Test filters in ERP interface first. | * **Tip 2:** Test filters in ERP interface first. | ||
| * **Tip 3:** Build filter strings programmatically. | * **Tip 3:** Build filter strings programmatically. | ||
| + | * **Tip 4:** Use openapi.json to discover available fields and filters. It is faster than an unfiltered request, downloads no data and includes field types. | ||
| **Example (Python):** | **Example (Python):** | ||
| Rida 762: | Rida 819: | ||
| ==== Essential Endpoints ==== | ==== Essential Endpoints ==== | ||
| < | < | ||
| - | Items: | + | API description GET / |
| - | Customers: | + | Items: |
| - | Orders: | + | Customers: |
| - | Invoices: | + | Orders: |
| - | Stock: | + | Invoices: |
| - | Deletions: | + | Stock: |
| + | Deletions: | ||
| </ | </ | ||
et/api_direct.1783409480.txt.gz · Viimati muutnud: 2026/07/07 10:31 persoon toomas