Difference between revisions of "API Add Person"

From zFairs Contest Management
(Created page with "== 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 our site. Below is an example of what needs to be poste...")
 
Line 1: Line 1:
 
== Add Person==
 
== 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 our site. Below is an example of what needs to be posted.
+
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.
  
 
<syntaxhighlight lang="JavaScript" line>
 
<syntaxhighlight lang="JavaScript" line>

Revision as of 15:44, 28 August 2020

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}
            }
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});