On this page

«حفظ كمسودة» and «الحفظ التلقائي» for the «المشاريع 2» form, and «نشر». The same contract as Project Drafts (/project-drafts), for the second projects section:

  • Who: projects2:manage, projects2:create or projects2:moderate; both gates of Projects 2 apply (403 FEATURE_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.

MethodPathSummary
GET/api/communities/{communityId}/projects2/draftsMy Projects 2 drafts in this community, most recently saved first
POST/api/communities/{communityId}/projects2/draftsSave 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}/publishPublish — the draft becomes a Projects 2 project

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200{ success, data: ProjectDraftSummary[] } — a summary per draft; open one with GET /draftIdobject

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—

Request body — application/json

Type: Project2DraftSaveForm

Responses

StatusDescriptionBody
201data is the ProjectDraft (revision 1)—
400PROJECT_DRAFT_INVALID — a field of the wrong type—
403Missing permission, RESTRICTION_BLOCKED, FEATURE_DISABLED, FEATURE_NOT_AVAILABLE, or storage quota exceeded—
409PROJECT_DRAFT_LIMIT — already 20 Projects 2 drafts—
413PROJECT_DRAFT_TOO_LARGE—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200Deleted—
404PROJECT_DRAFT_NOT_FOUND—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200data is the ProjectDraft—
404PROJECT_DRAFT_NOT_FOUND — missing, not the caller's, or a Projects (not Projects 2) draft—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Request body — application/json

Type: Project2DraftSaveForm

Responses

StatusDescriptionBody
200data is the ProjectDraft, revision + 1—
400PROJECT_DRAFT_INVALID—
404PROJECT_DRAFT_NOT_FOUND—
409PROJECT_DRAFT_CONFLICT — revision is stale; the body carries the current revision—
413PROJECT_DRAFT_TOO_LARGE—

The 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

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Request body — application/json

Type: Project2DraftSaveForm

Responses

StatusDescriptionBody
201Published; data is the Projects 2 project (its id is the draft's id)—
400PROJECT_DRAFT_INCOMPLETE with missing, PROJECT_DRAFT_INVALID, or the create endpoint's own checks (TOO_MANY_PROJECT_TYPES, PROJECT_OWNER_NOT_MEMBER)—
403Missing permission, RESTRICTION_BLOCKED, PROJECT_OWNER_ASSIGN_FORBIDDEN, FEATURE_DISABLED, FEATURE_NOT_AVAILABLE—
404PROJECT_DRAFT_NOT_FOUND—
409PROJECT_DRAFT_ALREADY_PUBLISHED with projectId, or PROJECT_DRAFT_CONFLICT—