Difference between revisions of "API Add Project"

From zFairs Contest Management
(Created page with "== 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....")
 
Line 45: Line 45:
  
 
=== Additional Optional fields of Participants ===
 
=== Additional Optional fields of Participants ===
All of these fields would be part of the body.
+
A participant record is very similar to a teacher record see [[API Add Person]] for optional fields of participants.
 
 
* '''Username''' (string max length 25)
 
**If this username is not available one will be assigned
 
* '''Password''' (string max length 25)
 
* '''HighestLevelOfEducation'''
 
**Less Than HS Graduate
 
**High School Diploma or Equivalent
 
**Some College
 
**Technical School
 
**2-Year College Degree
 
**4-Year College Degree
 
**Some Graduate School
 
**Master's Level Degree
 
**Doctorate (Academic)
 
**Doctorate (Professional)
 
**Not Indicated
 
*'''JobTitle'''
 
*'''Employer'''
 
*'''JudgesPreferences''' (object)
 
**this is an object, which can be added to body. like JudgesPreferences: { /* add the following optional parameters below */}
 
**you need to provide the category id's in the category1-3
 
**you need to provide judging Session id's for judgingSessions array
 
**See [[API_Get_Info]] to get these id's
 
***'''Category1''' (int)
 
***'''Category2''' (int)
 
***'''Category3''' (int)
 
***'''PreviouslyJudged''' (boolean true/false)
 
***'''JudgingSessions''' (int array)
 
****Not provided will not update sessions, empty array will clear out sessions for that judge.
 
****example [] or [1,2,...]
 

Revision as of 19:49, 10 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/person', {
    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'
				,Abstract: 'Project Abstract'
				,Description: 'Project Description'
				,Participants : [{
					FirstName: 'Jane' //Required
					,LastName: 'Doe' //Required
					,Grade: 6 //Required
					,TeacherId: '' //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);});


Additional Optional fields of Participants

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