Difference between revisions of "API Update Project"
From zFairs Contest Management
(Created page with "== Update Project== You can use our api to update a project to do this you need to POST a message to your site. Below is an example of what needs to be posted. <syntaxhighlig...") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Update Project== | == Update Project== | ||
− | You can use our api to update a project to do this you need to POST a message to your site. Below is an example of what needs to be posted. | + | You can use our api to update a project to do this you need to POST a message to your site. Below is an example of what needs to be posted. |
+ | |||
+ | If you need to add a project see [[API Add Project]] | ||
+ | |||
<syntaxhighlight lang="JavaScript" line> | <syntaxhighlight lang="JavaScript" line> | ||
Line 8: | Line 11: | ||
headers:{'Content-Type': 'application/json'}, | headers:{'Content-Type': 'application/json'}, | ||
body: JSON.stringify({ | body: JSON.stringify({ | ||
− | + | ApiKey:'<Private key>', | |
− | |||
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f | FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f | ||
Body: { | Body: { | ||
Line 23: | Line 25: | ||
,CategoryAwardId: 1 // optional | ,CategoryAwardId: 1 // optional | ||
,SpecialAwardsIds: [1, 2] //optional | ,SpecialAwardsIds: [1, 2] //optional | ||
− | " | + | "CustomQuestions" : //optional |
− | + | [{ | |
− | + | "Id": 123, | |
− | + | "Value": "This is my answer" | |
− | + | },...] | |
− | + | "Files": //optional | |
− | + | [{ | |
− | + | "Base64String" : "iVBORw0KGgoAAAANSUhEUgAAAQIAA...", //not required if you use DownloadFromUrl | |
− | + | "DownloadFromUrl":"http://yoursite.com/somefile.png",//optional can be used in stead of Base64String | |
− | + | "FileName": "myAwesomeFile.png", | |
− | + | "Caption": "indescribable" | |
− | + | }, | |
− | + | { | |
− | + | "Base64String" : "iVBORw0KGgoAAAANSUhEUgAAAQIAA...", | |
− | + | "FileName": "myAwesomeFile2.png", | |
+ | "Caption": "indescribable also" | ||
+ | }, | ||
+ | { | ||
+ | "DownloadFromUrl":"http://yoursite.com/somefile.png", | ||
+ | "FileName": "myAwesomething.pdf", | ||
+ | "Caption": "indescribable pdf" | ||
}] | }] | ||
} | } | ||
Line 49: | Line 57: | ||
== Where to get values == | == Where to get values == | ||
− | Various fields need id values such as '''CategoryId''', '''CategoryAwardId''', and '''SpecialAwardIds'''. You can get these values from our API. Check out [[API Get Info]] | + | Various fields need id values such as '''CategoryId''', '''CustomQuestion Ids''', '''CategoryAwardId''', and '''SpecialAwardIds'''. You can get these values from our API. Check out [[API Get Info]] |
+ | |||
+ | You can also add '''FixedProjectId''', this allows you to upload the project Id you want to be used for your uploaded project. | ||
− | |||
− | |||
− | + | ||
+ | <br/><br/><br/><br/> | ||
+ | [[Category: API]] |
Latest revision as of 20:57, 10 April 2024
Update Project
You can use our api to update a project to do this you need to POST a message to your site. Below is an example of what needs to be posted.
If you need to add a project see API Add Project
fetch('/api/data/project', {
method:'POST',
headers:{'Content-Type': 'application/json'},
body: JSON.stringify({
ApiKey:'<Private key>',
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
Body: {
Title:'Project Title' //Required
,CategoryId: 123 //Required
,SubCategoryId: 123 //optional
,Plan: 'Project Plan' // optional
,Abstract: 'Project Abstract'// optional
,Description: 'Project Description'// optional
,ProjectKey: ’36 char GUID’
,EntryVideoLink: ‘video Link’ //optional
,EntryVideoLink2: ‘video Link’ //optional
,CategoryAwardId: 1 // optional
,SpecialAwardsIds: [1, 2] //optional
"CustomQuestions" : //optional
[{
"Id": 123,
"Value": "This is my answer"
},...]
"Files": //optional
[{
"Base64String" : "iVBORw0KGgoAAAANSUhEUgAAAQIAA...", //not required if you use DownloadFromUrl
"DownloadFromUrl":"http://yoursite.com/somefile.png",//optional can be used in stead of Base64String
"FileName": "myAwesomeFile.png",
"Caption": "indescribable"
},
{
"Base64String" : "iVBORw0KGgoAAAANSUhEUgAAAQIAA...",
"FileName": "myAwesomeFile2.png",
"Caption": "indescribable also"
},
{
"DownloadFromUrl":"http://yoursite.com/somefile.png",
"FileName": "myAwesomething.pdf",
"Caption": "indescribable pdf"
}]
}
})
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});
Where to get values
Various fields need id values such as CategoryId, CustomQuestion Ids, CategoryAwardId, and SpecialAwardIds. You can get these values from our API. Check out API Get Info
You can also add FixedProjectId, this allows you to upload the project Id you want to be used for your uploaded project.