API Get Tags

From zFairs Contest Management
Revision as of 12:58, 20 July 2021 by Trent (talk | contribs) (Created page with "== Get Tags == You can use the zFairs api to get a list of existing tags which can be set on a person or project (entry). This api call will provide you a list of existing tag...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Get Tags

You can use the zFairs api to get a list of existing tags which can be set on a person or project (entry). This api call will provide you a list of existing tags.

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

This will return an object like so

{
	tags : [{
		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.
	}, ...],
}