Reposition a Taxon
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({taxon: {new_parent_id: 1, new_position_idx: 1}})
};
fetch('http://{defaultHost}/api/v2/platform/taxons/{id}/reposition', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "79",
"type": "taxon",
"attributes": {
"position": 0,
"name": "taxon_25",
"permalink": "taxonomy-39/shorts/taxon-25",
"lft": 3,
"rgt": 4,
"description": null,
"created_at": "2022-11-08T19:35:53.074Z",
"updated_at": "2022-11-08T19:35:53.324Z",
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"depth": 2,
"public_metadata": {},
"private_metadata": {},
"pretty_name": "taxonomy_39 -> Shorts -> taxon_25",
"seo_title": "taxon_25",
"is_root": false,
"is_child": true,
"is_leaf": true
},
"relationships": {
"parent": {
"data": {
"id": "78",
"type": "taxon"
}
},
"taxonomy": {
"data": {
"id": "39",
"type": "taxonomy"
}
},
"children": {
"data": []
},
"image": {
"data": {
"id": "115",
"type": "taxon_image"
}
}
}
}
}Was this page helpful?
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({taxon: {new_parent_id: 1, new_position_idx: 1}})
};
fetch('http://{defaultHost}/api/v2/platform/taxons/{id}/reposition', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "79",
"type": "taxon",
"attributes": {
"position": 0,
"name": "taxon_25",
"permalink": "taxonomy-39/shorts/taxon-25",
"lft": 3,
"rgt": 4,
"description": null,
"created_at": "2022-11-08T19:35:53.074Z",
"updated_at": "2022-11-08T19:35:53.324Z",
"meta_title": null,
"meta_description": null,
"meta_keywords": null,
"depth": 2,
"public_metadata": {},
"private_metadata": {},
"pretty_name": "taxonomy_39 -> Shorts -> taxon_25",
"seo_title": "taxon_25",
"is_root": false,
"is_child": true,
"is_leaf": true
},
"relationships": {
"parent": {
"data": {
"id": "78",
"type": "taxon"
}
},
"taxonomy": {
"data": {
"id": "39",
"type": "taxonomy"
}
},
"children": {
"data": []
},
"image": {
"data": {
"id": "115",
"type": "taxon_image"
}
}
}
}
}