WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#39424 closed defect (bug) (invalid)

WP REST API endpoints not coming up

Reported by: singhalavi Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords:
Focuses: rest-api Cc:
PR Number:

Description

I recently upgraded to wordpress 4.7, it says it includes New rest endpoints but when i fetch wp-json link it dont give rest response.

I already had WP REST api V1 installed, if i activate it endpoints for v1 comes but for v2 it does not come.

do i need to do anything extra to enable v2 endpoints ?

ex. site : https://hindi.puzzlersworld.com/wp-json

Change History (5)

#1 @dhanendran
3 years ago

@singhalavi Welcome to Trac.

When I hit the URL https://hindi.puzzlersworld.com/wp-json it gives me the V1 endpoints. You need to deactivate the WP-rest API plugin, as it is been included in the core itself.

#2 @singhalavi
3 years ago

@dhanendran thanks, but when i deactivate, it does not open json page, it opens homepage, i am deactivating it for next 30 minutes for you to see(as i can't keep deactivated for long, as it is used for our app)

#3 @dd32
3 years ago

  • Keywords close added

You'll probably need to flush your rewrite rules after deactivating the plugin too - you can do that by hitting save on the options -> permalinks page.
Accessing https://hindi.puzzlersworld.com/?rest_route=/ works, so there's nothing wrong with the rest api, just the plugin has interfered with it.

#4 @singhalavi
3 years ago

Ohh yes, it works after flushing.

can it be solved somehow programmatically, actually i develop a plugin based on WP REST API v1: https://wordpress.org/plugins/androapp/

i was working on updating it to use integrated apis, but this can be an issue when all of them update to 4.7.

#5 @rmccue
3 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Per above, the issue is that your rewrites weren't flushed. This typically happens on update, but if you have v1 of the API active when you update, it will continue to resolve to that. v1 is not compatible with the REST API in core, and is no longer supported.

Note: See TracTickets for help on using tickets.