I'm trying to create a jQuery/Ajax script to import data from a Wordpress API service and want to import the WP categories and tags into my database. I've managed to import the tags using an Ajax call to /actions/tags/createTag
, is there any endpoint that does the same with categories?
1 Answer
Of course there is, otherwise we would not be able to store categories in Craft. The controller that handles categories is called CategoriesController
and it contains the function actionSaveCategory
so you route will be actions/categories/saveCategory
To create/save a user you have the UsersController
.. You may guess the function is actionSaveUser
=> actions/users/saveUser
It's the same for every element in Craft. EntriesController
, actionSaveEntry
=> actions/entries/saveEntry
But this all has nothing to do with an endpoint or an API, it's just basic Craft code