المشاريع
يجمع المشروع حسابات سحابية وكل ما أُنشئ عبرها (الأجهزة الافتراضية، والتطبيقات،
والعمليات). ولكل مساحة عمل مشروع default (slug: "default"،
name: "Default") لا يمكن حذفه. وتذهب الحسابات السحابية الجديدة إلى مشروع
default ما لم يُرسل project_id (أو كان المستدعي رمز مشروع، فيُستخدم مشروعه).
رموز المشاريع (رموز API) مقصورة على مشروع واحد؛ انظر المصادقة.
GET /v1/projects
Section titled “GET /v1/projects”عرض المشاريع، الأقدم أولًا.
المصادقة: صلاحية read. ورمز المشروع لا يرى إلا مشروعه.
الرد 200:
{"items": [ {"id": "0c9d8e7f-1a2b-4c3d-8e5f-6a7b8c9d0e1f", "slug": "default", "name": "Default", "created_at": "2026-10-02T07:58:11Z"}, {"id": "e1d2c3b4-a5f6-4e7d-8c9b-0a1f2e3d4c5b", "slug": "staging", "name": "Staging", "created_at": "2026-11-10T12:00:00Z"}]}POST /v1/projects
Section titled “POST /v1/projects”إنشاء مشروع.
المصادقة: صلاحية admin؛ وليس رمز مشروع.
جسم الطلب
| الحقل | النوع | مطلوب | الوصف |
|---|---|---|---|
slug |
string | نعم | من 2 إلى 40 حرفًا لاتينيًا صغيرًا أو رقمًا أو شرطة، لا يبدأ بشرطة ولا ينتهي بها (^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$؛ يُحوَّل إلى أحرف صغيرة) |
name |
string | نعم | من 1 إلى 100 محرف |
{"slug": "staging", "name": "Staging"}الرد 201 (Project):
{"id": "e1d2c3b4-a5f6-4e7d-8c9b-0a1f2e3d4c5b", "slug": "staging", "name": "Staging", "created_at": "2026-11-10T12:00:00Z"}الأخطاء: 400 invalid_input؛ 409 conflict “a project with this slug
exists”؛ 403 permission_denied.
التدقيق: project.create.
curl -s -X POST "$MAYADYN/v1/projects" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" -d '{"slug":"staging","name":"Staging"}'DELETE /v1/projects/{id}
Section titled “DELETE /v1/projects/{id}”حذف مشروع.
المصادقة: صلاحية admin؛ وليس رمز مشروع.
| المعامل | الموضع | الوصف |
|---|---|---|
id |
path | UUID المشروع (لا تُقبل المعرّفات النصية هنا) |
الرد 204.
الأخطاء: 404 “project not found”؛ 409 conflict “the default project
cannot be deleted”؛ 409 conflict “the project still has connections or
resources”، مع التلميح “Delete or move them first.”
ملاحظات: تُحذف رموز API المقصورة على المشروع معه. ويُرفض الحذف ما دام أي حساب
سحابي أو مورد أو تطبيق يشير إلى المشروع (وكلها تُبلَّغ بالرسالة أعلاه).
التدقيق: project.delete.