ממשקי API: הבדלים בין גרסאות בדף
| שורה 1: | שורה 1: | ||
<span dir="ltr" class="mw-content-ltr"> | |||
<span dir="ltr" class="mw-content-ltr" style="direction:ltr !important"> | |||
=CRM API Documentation= | =CRM API Documentation= | ||
This documentation covers the core CRM endpoints: ''get_data.php'', ''set_data.php'', and ''set_status.php''. | This documentation covers the core CRM endpoints: ''get_data.php'', ''set_data.php'', and ''set_status.php''. | ||
גרסה אחרונה מ־13:22, 6 במרץ 2026
CRM API Documentation
This documentation covers the core CRM endpoints: get_data.php, set_data.php, and set_status.php.
Get Data API (get_data.php)
Endpoint: GET /api/get_data.php
This API endpoint retrieves customer data, call history information, and metadata based on specific search parameters.
Authentication
Every request must include the authkey parameter.
| Parameter | Required | Value / Notes |
|---|---|---|
authkey |
✅ | Mindc_2023_get_data
|
Request Parameters
Required Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
authkey |
string | ✅ | Authentication key. Must be Mindc_2023_get_data.
|
out |
string | ✅ | Comma-separated list of fields to retrieve. Example: out=first_name,last_name,last_status,last_call
|
Search Parameters
You must provide one of the following search combinations:
Combination A: By Repository Assign ID
| Parameter | Type | Required | Description |
|---|---|---|---|
repository_assign_id |
string | ✅ (for A) | A single assignment ID, or a comma-separated list of assignment IDs. |
Combination B: By Phone Number & Context
| Parameter | Type | Required | Description |
|---|---|---|---|
phone |
string | ✅ (for B) | The customer's phone number. |
did |
string | ✅* | DID number. |
project_id |
integer | ✅* | Project ID. |
worker_id |
integer | ✅* | Worker ID. |
group_id |
integer | ❌ | Optional filter. |
repository_id |
integer | ❌ | Optional filter. |
site_id |
integer | ❌ | Optional filter. |
✅* For Combination B, you must provide phone and at least one of: did, project_id, worker_id.
The optional filters (group_id, repository_id, site_id) may be used only with Combination B.
Output Fields (out parameter)
By default, uid is always returned.
You can request:
- Any dynamic customer field name (e.g.,
first_name,last_name,email) - Plus any of the following predefined fields:
| Field | Description |
|---|---|
last_status |
Description of the most recent customer status. |
last_call |
Timestamp of the most recent call. |
last_notes |
Text of the most recent note. |
repository_id |
ID of the repository. |
repository_name |
Name of the repository. |
repository_assign_id |
Assignment ID. |
Examples of Successful Requests
Example 1: Fetching data by repository_assign_id
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=first_name,last_status,last_call&repository_assign_id=102,103
Response:
{
"code": 0,
"status": "success",
"message": [
{
"uid": 102,
"first_name": "John",
"last_status": "Interested",
"last_call": "2023-10-15 14:30:00"
},
{
"uid": 103,
"first_name": "Jane",
"last_status": "Callback",
"last_call": "2023-10-16 09:15:00"
}
]
}
Example 2: Fetching data by phone and project_id
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=email,repository_name,last_notes&phone=5551234567&project_id=5
Response:
{
"code": 0,
"status": "success",
"message": [
{
"uid": 104,
"email": "customer@example.com",
"repository_name": "Main Leads",
"last_notes": "Customer asked to call back tomorrow."
}
]
}
Examples of Failed Requests
Error 1: Missing or Invalid Auth Key
Request:
GET /api/get_data.php?authkey=wrong_key&out=last_status&phone=5551234567&project_id=5
Response:
{
"code": 1,
"status": "fail",
"message": "Missing authkey or invalid value"
}
Error 2: Missing out Parameter
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&phone=5551234567&project_id=5
Response:
{
"code": 4,
"status": "fail",
"message": "Missing out parameter"
}
Error 3: Missing Search Criteria (no repository_assign_id and no phone)
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=last_status&project_id=5
Response:
{
"code": 3,
"status": "fail",
"message": "Missing phone_number parameter"
}
Error 4: Missing Context for Phone Search
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=last_status&phone=5551234567
Response:
{
"code": 5,
"status": "fail",
"message": "Missing project_id or worker_id or did input parameters"
}
Error 5: No Matching Customer Data
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=last_status&phone=999999999&project_id=999
Response:
{
"code": 6,
"status": "fail",
"message": "No matching customer found"
}
Error 6: Worker Not Found
Request:
GET /api/get_data.php?authkey=Mindc_2023_get_data&out=last_status&phone=5551234567&worker_id=9999
Response:
{
"code": 8,
"status": "fail",
"message": "Worker not found"
}
Error Response Codes Reference
| Code | Meaning |
|---|---|
1 |
Missing authkey or invalid value |
3 |
Missing phone_number parameter |
4 |
Missing out parameter |
5 |
Missing project_id or worker_id or did input parameters |
6 |
No matching customer found |
7 |
Database/SQL Exception |
8 |
Worker not found |
set_data.php
- Purpose
Update customer fields and/or status.
- Method
GET or POST
- Authorization Required
Yes (authkey): Mindc_2023_set_data
Parameters
| Parameter | Required | Description |
|---|---|---|
authkey |
✅ | Authentication key: Mindc_2023_set_data |
repository_assign_id |
⚠️* | Direct repository assign ID |
project_id |
⚠️* | Project ID (used if repository_assign_id not provided)
|
worker_id |
⚠️* | Worker ID (used if repository_assign_id not provided)
|
phone |
⚠️** | Customer phone (required if not using repository_assign_id)
|
did |
⚠️** | DID number (required if not using repository_assign_id)
|
group_id |
❌ | Filter for lookup |
repository_id |
❌ | Filter for lookup |
site_id |
❌ | Filter for lookup |
status_id |
❌ | Status ID to set |
| Any field name | ❌ | Any valid customer field (use display_name)
|
⚠️ Either repository_assign_id OR (project_id + worker_id + phone + did) is required.
⚠️ phone and did are required if not using repository_assign_id.
Example Requests
Update Customer Data (Using repository_assign_id)
POST /dev-6/api/set_data.php | authkey=Mindc_2023_set_data&repository_assign_id=555&first_name=Jane&email=jane@example.com
Content-Type: application/x-www-form-urlencoded
Update Status Only (Using Phone & Project Context)
GET /dev-6/api/set_data.php?authkey=Mindc_2023_set_data&did=123456&phone=972500000000&project_id=15&status_id=10
Update Data and Status Together (with worker_id)
POST /dev-6/api/set_data.php | authkey=Mindc_2023_set_data&repository_assign_id=555&city=New York&status_id=2&worker_id=99
Success Responses
- Fields Updated
{
"code": 0,
"status": "success",
"message": "email was updated to 'a@mail.com', name was updated to 'Anna'"
}
- Only Status Updated
{
"code": 0,
"status": "success",
"message": "Status set successfully"
}
- Partial Success
{
"code": 0,
"status": "success",
"message": "Fields updated",
"errors": {
"status": "Failed to set status"
}
}
Error Codes
| Code | Meaning |
|---|---|
| 1 | Missing or invalid authkey |
| 2 | Missing repository assign ID |
| 3 | Invalid repository assign ID |
| 4 | Duplicate unique field |
| 5 | Update failed |
| 6 | No valid fields or repository not found |
| 7 | No fields provided in request |
set_status.php
- Purpose
Set or clear customer status for a repository assign.
- Method
GET or POST
- Authorization Required
Yes (authkey): Mindc_2023_set_status
Parameters
| Parameter | Required | Description |
|---|---|---|
authkey |
✅ | Authentication key: Mindc_2023_set_status |
repository_assign_id |
✅ | Repository assign ID |
status_id |
✅ | Status ID (or 0 = clear status)
|
worker_id |
❌ | Worker ID (for audit purposes) |
Example Requests
Set Status for a Customer
GET /dev-6/api/set_status.php?authkey=Mindc_2023_set_status&repository_assign_id=555&status_id=10
Clear Status
POST /dev-6/api/set_status.php | authkey=Mindc_2023_set_status&repository_assign_id=555&status_id=0
Content-Type: application/x-www-form-urlencoded
Success Response
{
"code": 0,
"status": "success",
"message": "Status set successfully"
}
Error Codes
| Code | Meaning |
|---|---|
| 1 | Missing or invalid authkey |
| 2 | Missing repository assign ID |
| 3 | Invalid repository assign ID |
| 4 | Missing status ID |
| 5 | Failed to set status |