Skip Navigation

[Resolved] Setting up a API rest call for custom fields

This support ticket is created 2 years, 7 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2379943

LCR

We are trying to access data from custom fields using the REST API. We can retrieve some, but not all of the data. As you can see from the JSON below, we can retrieve "raw" data from a textfield and a checkbox, for example, but we are missing the "raw" data from "wysiwyg" fields for some reason. Can you explain how to get this data? This is the JSON output for a custom field group called "capture-techniques":

"capture-techniques": {
"display-c-t": {
"type": "checkbox",
"raw": "1"
},
"details": {
"type": "wysiwyg",
"raw": ""
},
"scan-locations-heading": {
"type": "textfield",
"raw": "Photogrammetry Data"
},
"scan-locations": {
"type": "image",
"raw": "",
"attachment_id": null
}
}

Any assistance would be greatly appreciated.

Thank you.

#2380105

Hello,

I have tried it in a fresh WP installation + the latest version of Toolset plugins, with below steps:
1) Create a custom field group + custom wysiwyg field "details"
2) Follow our document to expose the custom fields in REST API:
Toolset -> Settings page and on Custom Content tab enable the REST API option
https://toolset.com/documentation/programmer-reference/toolset-integration-with-the-rest-api/
3) Create a new post, fill value into the custom wysiwyg field "details"
4) Test the REST API result in frontend, it works fine
I can see the value in wysiwyg field "details" correctly

So the problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to WordPress default theme 2022, and test again

If the problem is fixed, activate other plugins/theme one by one, try to locate the problem plugin