Skip Navigation

[Resolved] Problem updating custom fields (CFs) in a custom post type (CPT) via REST API

This thread is resolved. Here is a description of the problem and solution.

Problem:
Problem updating custom fields (CFs) in a custom post type (CPT) via REST API

Solution:
But to update the custom field values, you will require to add your custom endpoint that should allow you to update the custom field. Please check the following related ticket:
- https://toolset.com/forums/topic/update-post-cuszom-fields-with-rest-api/#post-1430893

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/problem-updating-custom-fields-cfs-in-a-custom-post-type-cpt-via-rest-api/#post-1935077

Relevant Documentation:

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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 6 replies, has 2 voices.

Last updated by blazM-4 4 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1935041

Tell us what you are trying to do?

We are using Toolset to create custom post type with several custom fields. We are trying to create new custom post from our internal system using REST API. We are able to create custom post but only default fields (title, status, content) are populated with values sent in POST request. For authentication, we are using jwt token.

What is the proper way to populate values in Toolset custom fields via REST API POST request?

#1935063

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

In order to expose the Toolset custom fields to REST API response, you will require to activate the setting "Expose custom fields managed by Types for posts, users, and terms through the REST API" from the REST API section form:
=> Toolset -> Settings page => Custom Content tab => REST API section

This will add a toolset-meta property with custom fields to posts, users and terms that show in REST responses.

More info:
- https://toolset.com/documentation/programmer-reference/toolset-integration-with-the-rest-api/

#1935065

I am sorry, I forgot to mention that we did that, of course.

#1935067

Minesh
Supporter

Languages: English (English )

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

Ahh - do you mean that you want to update the Toolset custom field value using REST API endpoint?

#1935071

Yes, exactly. The standard fields work, but CFs no.

I suggest the Tags for this ticket are REST API, updating, custom fields

#1935077

Minesh
Supporter

Languages: English (English )

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

The thing is that Toolset offers feature to expose the custom fields when you activate the said settings. REST API implementation with Toolset is limited where we offer only the GET so that the Toolset custom fields will be exposed to REST API response, and setting (updating) the custom field values is not supported.

But to update the custom field values, you will require to add your custom endpoint that should allow you to update the custom field. Please check the following related ticket:
- https://toolset.com/forums/topic/update-post-cuszom-fields-with-rest-api/#post-1430893

#1935363

I hope this works, thanks.