Skip Navigation

[Resolved] Rest API basic functionality

This support ticket is created 3 years, 2 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 6 replies, has 2 voices.

Last updated by mattP-11 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2523485

I am trying to:GET a custom post type

Link to a page where the issue can be seen:curl -X OPTIONS -i hidden link

I expected to see:an array of posts

Instead, I got:http 200 but no posts

#2523589

Hello,

I assume we are talking about a custom post type "Course" created with Toolset Types plugin.
I have tried it in a fresh WP installation + the latest version of Toolset plugins, it works fine, you can see it in below test site.

Login URL:
hidden link

Custom post type "Course":
hidden link

REST API result:
hidden link

Is there any missing steps? can you reproduce the same problem in above test site? thanks

#2525843

That does nothing for me.

I have a site made with Toolset Types 2 many years ago. I upgraded to 3, checked "show_in_rest", and added add_filter( 'toolset_rest_run_exposure_filters', '__return_true' ); to my functions.php.

It returns nothing for every type. I also disabled all other plugins to test it.

What else do I need to do?

#2526097

I assume you can not reproduce the same problem in above test site too.
It might be a compatibility issue, some other plugins/theme prevent the REST API works in your website.

Please check these:
1) deactivate all other plugins, and switch to WordPress default theme 2022, and test again
2) Also check if there is any PHP error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#php-debugging
3) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2526641

I am downloading the files, will update here if find anything

#2526829

Please try this in your website:
hidden link
Edit the custom post type "Course", in section "Options", enable setting "show_in_rest", save and test again

It works fine with your duplicator package in my localhost.

#2528101

My issue is resolved now. Thank you!