Post Types API - How to Edit Post Types Data with API Calls

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000099435-post-types-api-how-to-edit-post-types-data-with-api-calls

Using the API there are 5 Post Type actions that can be achieved:

  1. GET - /api/v2/data_categories/get/{data_id} 
  2. POST - /api/v2/data_categories/create
  3. POST - /api/v2/data_categories/custom_fields
  4. PUT - /api/v2/data_categories/update 
  5. DELETE - /api/v2/data_categories/delete 


We will break down these actions and explain how to achieve an end results with each one. The examples shown in this article are completed using https://www.postman.com/


For all actions, add the API Key to the Headers:



1. GET - /api/v2/data_categories/get/{data_id}

Read the data of a single Post Type based on the Data ID.

  • Choose GET as the method
  • Replace the {{api_url}} for the website url
  • Replace the {id} with the actual post type ID


Using this action is simple, add the url above but replace {id} with the actual post type ID. This will fetch the post types information from the website.



2. POST - /api/v2/data_categories/create
Add a Post Type to the database.

  • Choose POST as the method
  • In the Body select x-www-form-urlencoded
  • Enter data



3. POST - /api/v2/data_categories/custom_fields

Get all fields available for the Post Type.

  • Choose POST as the method. 
  • In the Body select x-www-form-urlencoded
  • Then add the data_id of the Post Type



4. PUT - /api/v2/data_categories/update

Update a Post Type record and their related data from the database.

  • Choose PUT as the method
  • In the Body select x-www-form-urlencoded
  • Then add the new data for the Post Type



5. DELETE - /api/v2/data_categories/delete

Use this action URL to delete a Post Type, replace {id} with the Post Type ID that will be removed from the website.

  • Choose DELETE as the method
  • Replace the {id} with the data_id that will be deleted
  • In the Params add the data_id to delete