«حفظ كمسودة» and «الحفظ التلقائي» for the «المشاريع 2» form, and «نشر». The same
contract as Project Drafts (/project-drafts), for the second projects section:
- Who:
projects2:manage,projects2:createorprojects2:moderate; both gates of Projects 2 apply (403FEATURE_DISABLED/FEATURE_NOT_AVAILABLE). - Files: named as in the Projects 2 create form —
project2Logo,project2Banner,product2Image. - Publishing creates a Projects 2 project (its id is the draft's id).
- A draft belongs to one section: a Projects draft id answers 404 here, and the reverse.
6 endpoints.
| Method | Path | Summary |
|---|---|---|
GET | /api/communities/{communityId}/projects2/drafts | My Projects 2 drafts in this community, most recently saved first |
POST | /api/communities/{communityId}/projects2/drafts | Save a new Projects 2 draft (the first «حفظ كمسودة» or autosave) |
DELETE | /api/communities/{communityId}/projects2/drafts/{draftId} | Discard a Projects 2 draft |
GET | /api/communities/{communityId}/projects2/drafts/{draftId} | One of my Projects 2 drafts (to reopen it in the form) |
PUT | /api/communities/{communityId}/projects2/drafts/{draftId} | Autosave / save — only the fields sent change |
POST | /api/communities/{communityId}/projects2/drafts/{draftId}/publish | Publish — the draft becomes a Projects 2 project |
GET /api/communities/{communityId}/projects2/draftsAuth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | { success, data: ProjectDraftSummary[] } — a summary per draft; open one with GET /draftId | object |
POST /api/communities/{communityId}/projects2/draftsAuth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
Request body — application/json
Type: Project2DraftSaveForm
Responses
| Status | Description | Body |
|---|---|---|
201 | data is the ProjectDraft (revision 1) | — |
400 | PROJECT_DRAFT_INVALID — a field of the wrong type | — |
403 | Missing permission, RESTRICTION_BLOCKED, FEATURE_DISABLED, FEATURE_NOT_AVAILABLE, or storage quota exceeded | — |
409 | PROJECT_DRAFT_LIMIT — already 20 Projects 2 drafts | — |
413 | PROJECT_DRAFT_TOO_LARGE | — |
DELETE /api/communities/{communityId}/projects2/drafts/{draftId}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
draftId | path | yes | string (uuid) | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Deleted | — |
404 | PROJECT_DRAFT_NOT_FOUND | — |
GET /api/communities/{communityId}/projects2/drafts/{draftId}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
draftId | path | yes | string (uuid) | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | data is the ProjectDraft | — |
404 | PROJECT_DRAFT_NOT_FOUND — missing, not the caller's, or a Projects (not Projects 2) draft | — |
PUT /api/communities/{communityId}/projects2/drafts/{draftId}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
draftId | path | yes | string (uuid) | — |
Request body — application/json
Type: Project2DraftSaveForm
Responses
| Status | Description | Body |
|---|---|---|
200 | data is the ProjectDraft, revision + 1 | — |
400 | PROJECT_DRAFT_INVALID | — |
404 | PROJECT_DRAFT_NOT_FOUND | — |
409 | PROJECT_DRAFT_CONFLICT — revision is stale; the body carries the current revision | — |
413 | PROJECT_DRAFT_TOO_LARGE | — |
POST /api/communities/{communityId}/projects2/drafts/{draftId}/publishThe body is optional and is saved first, exactly like PUT, then the draft is
published and deleted. notifyMembers here overrides the value the draft stored.
Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
communityId | path | yes | string (uuid) | — |
draftId | path | yes | string (uuid) | — |
Request body — application/json
Type: Project2DraftSaveForm
Responses
| Status | Description | Body |
|---|---|---|
201 | Published; data is the Projects 2 project (its id is the draft's id) | — |
400 | PROJECT_DRAFT_INCOMPLETE with missing, PROJECT_DRAFT_INVALID, or the create endpoint's own checks (TOO_MANY_PROJECT_TYPES, PROJECT_OWNER_NOT_MEMBER) | — |
403 | Missing permission, RESTRICTION_BLOCKED, PROJECT_OWNER_ASSIGN_FORBIDDEN, FEATURE_DISABLED, FEATURE_NOT_AVAILABLE | — |
404 | PROJECT_DRAFT_NOT_FOUND | — |
409 | PROJECT_DRAFT_ALREADY_PUBLISHED with projectId, or PROJECT_DRAFT_CONFLICT | — |