API Add School: Difference between revisions

From zFairs Contest Management
No edit summary
No edit summary
Line 1: Line 1:
== Add Schools ==
== Add Schools ==
You can use our api to add schools 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 schools 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:45, 28 August 2020

Add Schools

You can use our api to add schools 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/school', {
    method:'POST',
    headers:{'Content-Type': 'application/json'},
    body: JSON.stringify({
            Username:'admin username',
            Password: 'password',
            Body: {
                Name: '_ A Test School'
                ,Address: '1219 34th State'
                ,Address2: 'Apt 3'
                ,City: 'Ogden'
                ,State: 'Ut'
                ,Zip: '84403'
                ,County: 'Weber'
                ,Phone: '801-252-0903'
                ,WebsiteUrl: 'zfairs.com'
                ,SchoolType: 'Public' //{ Public, Private, Charter, Home}
                ,PrincipalName: 'Mrs Bell'
                ,PrincipalPhone: '801-252-0000'
                ,PrincipalEmail: 'MrsBell@zfairs.com'
                ,ContactFirstName: 'Joe'
                ,ContactLastName: 'Homes'
                ,ContactPhone: '801-252-0001'
                ,ContactEmail: 'jh@zfairs.com'
                ,GradeLow: '0' //pre-k = -1, k = 0
                ,GradeHigh: '12'
                ,Fax: '801-252-0003'
            }
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});