Sensei: Turn the REST API on by default

Created on 28 Feb 2018  路  3Comments  路  Source: Automattic/sensei

Currently, define( 'SENSEI_FEATURE_FLAG_REST_API_V1', true); needs to be added to wp-config in order to enable Sensei's REST API.

In order for Sensei to work with Gutenberg, we need to eliminate that requirement and enable the REST API by default.

[Status] Accepted [Type] Enhancement

Most helpful comment

It doesn't matter too much to me if we use custom endpoints or not. But if we piggy back on the WP REST API, then we need to explicitly handle post meta, as it doesn't get returned by default.

I'd lean more toward not building custom endpoints, because I think that means we could get rid of the Mixtape dependency.

All 3 comments

@donnapep Was there anything in particular that you found didn't work if that feature flag was not set?

The reason I ask is that we seem to have two different "versions" of the API. We have custom endpoints in includes/rest-api/*, which are enabled by this feature flag. But we also have our CPT's being added to the default REST API by using the show_in_rest option of register_post_type.

AFAICT, it's the second of those that adds Gutenberg support to our CPT's in WP Admin. When I disable it in code, I lose the ability to use Gutenberg with our CPT's (e.g. courses). Enabling and disabling the custom endpoints with the feature flag doesn't seem to make a difference.

From chatting with Panos:

Initially the idea was to do completely custom endpoints

but then, given how we went about wpjm rest api, we enabled the cpt endpoints

Actually I remember that this was someone鈥檚 request (enabling the cpt ones)

I鈥檇 say it鈥檚 up to us

but yeah should be one of those two not both :smile:

Granted I haven't looked really deeply into what the custom endpoints do, and whether they do something that the CPT endpoints do not. But it seems like maybe we should double down on the CPT endpoints for Gutenberg support, and consider removing the custom ones if they aren't being used.

Thoughts?

It doesn't matter too much to me if we use custom endpoints or not. But if we piggy back on the WP REST API, then we need to explicitly handle post meta, as it doesn't get returned by default.

I'd lean more toward not building custom endpoints, because I think that means we could get rid of the Mixtape dependency.

Closing as we'll use the WP REST API.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kraftbj picture kraftbj  路  4Comments

richardmtl picture richardmtl  路  7Comments

danjjohnson picture danjjohnson  路  6Comments

BusinessBloomer picture BusinessBloomer  路  3Comments

danjjohnson picture danjjohnson  路  5Comments