الفريق والأسطولإضافة فنّي

إضافة فنّي

ينشئ عضوية فنّي ضمن النشاط التجاري الحالي. إذا طابق الهاتف/البريد الإلكتروني مستخدمًا موجودًا، يُربَط حسابه. وإلا تُنشأ هوية مستخدم جديدة (بلا بريد دعوة — تسجيل الدخول بلا كلمة مرور لاحقًا). في كلتا الحالتين تبدأ العضوية نشطة. وإذا كان الفنّي قد أُزيل سابقًا (deactive) فيُعاد تنشيطه بدلًا من ذلك. لا يمكن إسناد مجموعتَي المالك/المسؤول عبر مفتاح API، ولا مطلقًا في وضع بيئة الاختبار. علاقات اختيارية (كلها مُتحقَّق منها؛ أي معرّف مفقود ← 404 TECHNICIAN_NOT_FOUND مع `missing_ids`): تضبط `buddy_ids` قائمة مرافقي هذا الفنّي (استخدمها عند إنشاء قائد)؛ وتضيف `lead_ids` هذا الفنّي كمرافق لكل قائد مذكور (استخدمها عند إنشاء مرافق — وهي الطريقة من جانب المرافق لربط علاقة lead↔buddy نفسها)؛ وتُسند `service_area_ids` الفنّي إلى مناطق الخدمة تلك. تلتقط `start_location_type=office` عنوان النشاط التجاري + إحداثياته في الفنّي وقت الإنشاء؛ وتُتجاهَل `address` و`start_location_lat` و`start_location_long` في المتن. تتطلّب أن تكون إحداثيات النشاط التجاري مضبوطة (وإلا 400 BUSINESS_LOCATION_MISSING). وتستخدم `start_location_type=home` (أو الفارغة) العنوان + الإحداثيات من المتن.

المعاملات

Idempotency-Keystringheaderاختياري
Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.
addressobjectbodyاختياري
Home address (the day-start point when start_location_type=home).
citystringbodyاختياري
City / locality.
countrystringbodyاختياري
Country (free-form or ISO code).
formattedstringbodyاختياري
سلسلة العرض الكاملة؛ عند ضبطها تتقدّم على الأجزاء المنفصلة في العرض.
linestringbodyاختياري
سطر الشارع 1.
line2stringbodyاختياري
سطر الشارع 2 (وحدة، جناح).
postal_codestringbodyاختياري
الرمز البريدي.
statestringbodyاختياري
State / province / region.
assignment_tierenumbodyاختياري
فئة الطاقم التي يُسند وفقها محرك المطابقة: lead (يمكنه قيادة عمل)، buddy (مساعد طاقم)، float (مستبعَد من الإسناد التلقائي للطاقم).
buddy_idsarray<string>bodyاختياري
BuddyIDs — مرافقو هذا الفنّي (تُضبَط عند إنشاء قائد). LeadIDs — القادة الذين يكون هذا الفنّي مرافقًا لهم (تُضبَط عند إنشاء مرافق؛ يُلحَق الفنّي بقائمة مرافقي كل قائد). ServiceAreaIDs — مناطق الخدمة لإسناد الفنّي إليها. كلها اختيارية.
business_group_idstringbodyمطلوب
مجموعة الدور للعضو الجديد. اكتشف المعرّفات عبر GET /permission/groups (مجموعتا المالك/المسؤول مرفوضتان في وضع بيئة الاختبار).
emailstringbodyاختياري
Email address. At least one of phone/email is required (identity resolution key).
full_namestringbodyمطلوب
The person's full display name. Required; max 255 chars.
job_titlestringbodyاختياري
المسمى المعروض (مثل "فنّي تدفئة وتكييف أول").
join_datestringbodyاختياري
أول يوم عمل (YYYY-MM-DD).
lead_idsarray<string>bodyاختياري
Leads this technician is a buddy of (set when creating a buddy; the technician is appended to each lead's buddy list). Optional; max 50 technician ids.
phonestringbodyاختياري
يلزم توفير أحد الحقلين phone/email على الأقل (مفتاح تحديد الهوية).
service_area_idsarray<string>bodyاختياري
Service areas to assign the technician to. Optional; max 50. Discover via GET /service-areas.
start_location_latnumberbodyاختياري
إحداثيات بدء اليوم الصريحة؛ عند ضبطها تتقدّم على ترميز عنوان الموقع.
start_location_longnumberbodyاختياري
Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
start_location_typeenumbodyاختياري
من أين يبدأ الفنّي يومه: home (عنوانه) أو office (موقع النشاط التجاري). يقود تقديرات التنقّل في المحرك.
POST/v1/technicians
curl -X POST "https://api.crisphive.com/v1/technicians" \
  -H "Authorization: Bearer chsk_test_4eC8xQ9mZ2pL7Ka0rT" \
  -H "Content-Type: application/json" \
  -d '{
  "address": {
    "city": "San Francisco",
    "country": "US",
    "formatted": "123 Market Street, San Francisco, CA 94103",
    "line": "123 Market Street",
    "line2": "Suite 200",
    "postal_code": "94103",
    "state": "CA"
  },
  "assignment_tier": "lead",
  "buddy_ids": [
    "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01"
  ],
  "business_group_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01",
  "email": "jane.doe@example.com",
  "full_name": "Jane Cooper",
  "job_title": "Sample title",
  "join_date": "2026-07-02",
  "lead_ids": [
    "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01"
  ],
  "phone": "+14155550142",
  "service_area_ids": [
    "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01"
  ],
  "start_location_lat": 1,
  "start_location_long": 1,
  "start_location_type": "home"
}'
نص الطلب
{
"address": {
"city": ,
"country": ,
"formatted": ,
"line": ,
"line2": ,
"postal_code": ,
"state":
},
"assignment_tier": ,
"buddy_ids": [
],
"business_group_id": ,
"email": ,
"full_name": ,
"job_title": ,
"join_date": ,
"lead_ids": [
],
"phone": ,
"service_area_ids": [
],
"start_location_lat": ,
"start_location_long": ,
"start_location_type":
}

الاستجابات