Difference between revisions of "API Add Project"

From zFairs Contest Management
Line 14: Line 14:
 
Title:'Project Title' //Required
 
Title:'Project Title' //Required
 
,CategoryId  //Required
 
,CategoryId  //Required
,Plan: 'Project Plan'
+
,Plan: 'Project Plan' // optional
,Abstract: 'Project Abstract'
+
,Abstract: 'Project Abstract'// optional
,Description: 'Project Description'
+
,Description: 'Project Description'// optional
 
,CategoryAwardId: 1 // optional
 
,CategoryAwardId: 1 // optional
 
,SpeicalAwardIds: [1, 2] //optional
 
,SpeicalAwardIds: [1, 2] //optional

Revision as of 10:58, 15 September 2020

Add Project

You can use our api to add a project and it's participants 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: {
				Title:'Project Title' //Required
				,CategoryId  //Required
				,Plan: 'Project Plan' // optional
				,Abstract: 'Project Abstract'// optional
				,Description: 'Project Description'// optional
				,CategoryAwardId: 1 // optional
				,SpeicalAwardIds: [1, 2] //optional
				,Participants : [{
					FirstName: 'Jane' //Required
					,LastName: 'Doe' //Required
					,Grade: 6 //Required
					,TeacherId: '9df61f13-474b-442f-ac1f-edca7348ef71' //Required
					,SchoolId: 24 //Required
					,Email: 'jane@example.com'
					,Email1: 'Doe@example.com'
					,Phone: '800-000-0000'
					,Phone1: '800-123-1324'
					,Address: '1219 45th st'
					,Address2: 'APT 3B'
					,City: 'Ogden'
					,State: 'VA'
					,Zip: '65951'
					,Role: 'Student' 
				}]
			}
        })
})
.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, CategoryAwardId, and SpecialAwardIds. You can get these values from our API. Check out API Get Info

Additional Optional fields of Participants

A participant record is very similar to a teacher record see API Add Person for optional fields of participants.