API Update Project

From zFairs Contest Management
Revision as of 12:55, 25 July 2026 by Trent (talk | contribs) (Remove username/password API auth; ApiKey only)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Update Project

Updates an existing project identified by ProjectKey. Can update core fields, custom questions, and attach additional files.

Authentication

All data API calls are POST (unless noted) with JSON body:

Field Required Description
ApiKey Yes Private API key for your site.
FairId Yes Fair GUID from the site URL (f query parameter).
Body Depends Request payload. Use {} when no body fields are needed.


Calls must be run server-side — do not expose your API key in a browser.

Response envelope

Most endpoints return:

{
  Success: true,
  Message: null,   // error text when Success is false
  Body: { ... }    // endpoint-specific payload
}


Request

fetch('/api/data/project/update', {
    method:'POST',
    headers:{'Content-Type': 'application/json'},
    body: JSON.stringify({
            ApiKey:'<Private key>',
            FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', // value of f in your URL
            Body: {
				ProjectKey: "32161f13-474b-442f-ac1f-edca7348e000", // required
				Title: "Updated Title",
				CategoryId: 123,
				SubCategoryId: 456,
				Plan: "Updated plan",
				Abstract: "Updated abstract",
				Description: "Updated description",
				EntryVideoLink: "https://...",
				EntryVideoLink2: "https://...",
				FixedProjectId: "AB-100",
				EntryTypeId: 2,
				Approved: true,
				CustomQuestions: [{ Id: 55, Value: "small" }],
				Files: [{
					Base64String: "iVBORw0KGgo...",
					FileName: "extra.png",
					Caption: "Extra image"
				}],
				Participants: []  // optional; used mainly if attaching participant profile pictures
			}
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});

Response

On success returns the request body with ProjectId/ProjectKey filled, and optional InterviewRoomUrl.

{
  Success: true,
  Message: null,
  Body: { ProjectKey: "...", ProjectId: "AB-100", Title: "Updated Title", ... }
}

If the project is missing or not in the fair:

{ Success: false, Message: "Project not found" }


Field notes

  • ProjectKey is required.
  • This endpoint does not re-register participants the way API Add Project does; focus is project metadata and files.
  • For display project id batch updates, see API Set Project Id.


Related APIs