Difference between revisions of "API Get Info"

From zFairs Contest Management
(Created page with "== Get Info== Some of our api calls will require you to have additional information such as category ids or judging session ids. This api call will provide that information. T...")
 
 
(7 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
     headers:{'Content-Type': 'application/json'},
 
     headers:{'Content-Type': 'application/json'},
 
     body: JSON.stringify({
 
     body: JSON.stringify({
             Username:'admin username',
+
             ApiKey:'<Private key>',
             Password: 'password',
+
             FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
 
             Body: {}
 
             Body: {}
 
         })
 
         })
Line 18: Line 18:
  
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
This will return an object like so
 +
 +
<syntaxhighlight lang="JavaScript" line>
 +
 +
{
 +
Categories : [{
 +
Id: 123,
 +
Name: "math",
 +
Abbreviation: "ma"
 +
}, ...],
 +
SubCategories : [{
 +
Id: 123,
 +
Name: "hard math",
 +
Abbreviation: "hm"
 +
}, ...],
 +
JudgingSessions: [{
 +
Id: 123,
 +
Name: "early morning",
 +
MinGrade: "6",
 +
MaxGrade: "12",
 +
StartTime: "",
 +
EndTime: "",
 +
}, ...],
 +
SpecialAwards: [{
 +
Id: 123,
 +
Name: "big winner",
 +
}, ...],
 +
CategoryAward: [{
 +
Id: 123,
 +
Name: "first place",
 +
}, ...],
 +
PaperworkFileTypes: [{
 +
Id: 123,
 +
Name: "form 1c",
 +
}, ...],
 +
Rounds: [{
 +
Id: 123,
 +
Name: "Round One",
 +
}, ...],
 +
ProjectCustomQuestions: [{
 +
Id: 123,
 +
Name: "How big is your project",
 +
Values : ["small","large"] // this is only populated if the question has preset values.
 +
}, ...],
 +
EntryTypes: [{
 +
Id: 123,
 +
PublicId: "9df61f13-474b-442f-ac1f-edca7348ef71",
 +
Name: "Research Entry"
 +
}]
 +
}
 +
 +
 +
</syntaxhighlight>
 +
 +
 +
 +
<br/><br/><br/><br/>
 +
[[Category: API]]

Latest revision as of 20:50, 10 April 2024

Get Info

Some of our api calls will require you to have additional information such as category ids or judging session ids. This api call will provide that information. The results of this api call will grow as our api expands.

fetch('/api/data/info', {
    method:'POST',
    headers:{'Content-Type': 'application/json'},
    body: JSON.stringify({
            ApiKey:'<Private key>',
            FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
            Body: {}
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});

This will return an object like so

{
	Categories : [{
		Id: 123,
		Name: "math",
		Abbreviation: "ma"
	}, ...],
	SubCategories : [{
		Id: 123,
		Name: "hard math",
		Abbreviation: "hm"
	}, ...],
	JudgingSessions: [{
		Id: 123,
		Name: "early morning",
		MinGrade: "6",
		MaxGrade: "12",
		StartTime: "",
		EndTime: "",
	}, ...],
	SpecialAwards: [{
		Id: 123,
		Name: "big winner",
	}, ...],
	CategoryAward: [{
		Id: 123,
		Name: "first place",
	}, ...],
	PaperworkFileTypes: [{
		Id: 123,
		Name: "form 1c",
	}, ...],
	Rounds: [{
		Id: 123,
		Name: "Round One",
	}, ...],
	ProjectCustomQuestions: [{
		Id: 123,
		Name: "How big is your project",
		Values : ["small","large"] // this is only populated if the question has preset values.
	}, ...],
	EntryTypes: [{
		Id: 123,
		PublicId: "9df61f13-474b-442f-ac1f-edca7348ef71",
		Name: "Research Entry"
	}]
}