Skip Navigation

[Waiting for user confirmation] API for creating custom post

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 1 voice.

Last updated by Minesh 1 day, 9 hours ago.

Assisted by: Minesh.

Author
Posts
#2842565

Hi,

Is there an API to create custom post with relationship? I want to automatically create or update a custom post based on the data received from a rest api call or database query.

Thank you.

#2842570

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Yes - Toolset offers post relationship API. To connect the post, you can use the following post-relationshp API function: toolset_connect_posts
- https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

To create/update post as well as post meta or taxonomy attached to post you can use native WordPress functions.

Please check the following related tickets and Docs that might help you:
- https://toolset.com/forums/topic/import-relationships-from-api/
- https://toolset.com/es/forums/topic/create-relationship-in-cred-cred_save_data/
- https://toolset.com/documentation/programmer-reference/toolset-integration-with-the-rest-api/

#2842840

Hi,

Follow-up question:
"To create/update post as well as post meta or taxonomy attached to post you can use native WordPress functions."
I need to create/update a Toolset Custom Post from a JSON data. Can you give a guide/example on how to use Toolset Custom Fields when creating a WordPress standard post via API?

Thanks.

#2842845

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As shared before - Toolset integration with REST API is limited and offers the GET callback where custom fields are exposed to REST API callback response:
=> https://toolset.com/documentation/programmer-reference/toolset-integration-with-the-rest-api/

You will require to define the endpoint to register the update callback function for the user meth.

Please check the following related link:
- https://wordpress.stackexchange.com/questions/338134/updating-custom-wordpress-user-meta-field-via-rest-api

Please check the following related ticket:
- https://toolset.com/forums/topic/what-does-the-json-request-look-like-to-update-custom-field-values/?paged=2#post-2666487
- https://toolset.com/forums/topic/update-toolset-meta-data-via-the-rest-api/#post-2275145