Difference between revisions of "API Set Tags"

From zFairs Contest Management
(Created page with "== Get Tags == You can use the zFairs api to add an existing tag to a person or project (entry). This api call will allow you to set tags, if you need to see a list of exiting...")
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Get Tags ==
+
== Set Tags ==
 
You can use the zFairs api to add an existing tag to a person or project (entry). This api call will allow you to set tags, if you need to see a list of exiting tags see [[API Get Tags]].
 
You can use the zFairs api to add an existing tag to a person or project (entry). This api call will allow you to set tags, if you need to see a list of exiting tags see [[API Get Tags]].
  
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
 
             FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
 
             Body: {
 
             Body: {
Line 24: Line 23:
  
 
Please make sure when setting tags you use the correct tag types. Meaning only set project tags to projects and only set person tags to people.
 
Please make sure when setting tags you use the correct tag types. Meaning only set project tags to projects and only set person tags to people.
 +
 +
 +
 +
<br/><br/><br/><br/>
 +
[[Category: API]]

Latest revision as of 21:57, 10 April 2024

Set Tags

You can use the zFairs api to add an existing tag to a person or project (entry). This api call will allow you to set tags, if you need to see a list of exiting tags see API Get Tags.

fetch('/api/data/tags/set', {
    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: {
				tagId: 15,
				Ids: ['e7a0ccab-350d-4ab8-9482-04c5f9750caa',...] //
			}
        })
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data, data.Body); })
.catch((error)=>{console.log('Error: ', error);});

Please make sure when setting tags you use the correct tag types. Meaning only set project tags to projects and only set person tags to people.