API Upload Project Assets

From zFairs Contest Management
Revision as of 14:43, 5 November 2020 by Trent (talk | contribs) (Created page with "== Upload Project Image == You can use our api to upload images to a project, so these can be viewed by your judges or in the showcase. To do this you need to POST a message t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Upload Project Image

You can use our api to upload images to a project, so these can be viewed by your judges or in the showcase. To do this you need to POST a message to your site. Below is an example of what needs to be posted.

fetch('/api/data/project', {
    method:'POST',
    headers:{'Content-Type': 'application/json'},
    body: JSON.stringify({
            Username:'admin username',
            Password: 'password',
            FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
            Body: {
				"ProjectKey":"32161f13-474b-442f-ac1f-edca7348e000"
				"Base64String" : "iVBORw0KGgoAAAANSUhEUgAAAQIAA...",
				"DownloadFromUrl":"http://yoursite.com/somefile.png" //optional can be used in stead of Base64String
				"FileName": "myAwesomeFile.png",
				"Caption": "indescribable"
			}
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});