API Add Person

From zFairs Contest Management
Revision as of 16:35, 3 September 2020 by Trent (talk | contribs)

Add Person

You can use our api to add a teacher or judge to your contest. 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',
            Body: {
                        FirstName: 'Jane'
			,LastName: 'Doe'
			,Prefix: 'Dr'
			,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'
			,SchoolsTeachesAt: [1] // int array of school ids
			,Role: 'Teacher' // { Teacher, Judge, Staff, Admin, Volunteer}
                        ,Password: 'hello123' 
                        ,Username: 'User123' //If this username is not available one will be assigned
            }
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});