Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for new WP-API URLs #17

Merged
merged 1 commit into from
Mar 28, 2016
Merged

Prepare for new WP-API URLs #17

merged 1 commit into from
Mar 28, 2016

Conversation

nylen
Copy link
Contributor

@nylen nylen commented Mar 27, 2016

We're in the process of migrating WP-API URLs as follows (ref: pMz3w-5l5-p2)

- public-api.wordpress.com/wp-json/sites/4/wp/v2/types
+ public-api.wordpress.com/wp/v2/sites/4/types

- public-api.wordpress.com/wp-json/sites/4/wpcom/v2/post-counts
+ public-api.wordpress.com/wpcom/v2/sites/4/post-counts

For a short time, we'll need to support both URL patterns. I propose to do this by detecting the presence of a / in the apiNamespace parameter. Further reading on API namespaces: http://v2.wp-api.org/extending/adding/#namespacing

I expect that client code will call API requests as follows:

this.wpcom.req.get( '/sites/%s/post-counts', { apiNamespace: 'wpcom/v2' } );

Then the transport library (such as this one or rest-proxy) will combine the namespace and the request path.

cc @timmyc @retrofox

@retrofox
Copy link
Contributor

🚢

@nylen nylen merged commit 2a2e28e into master Mar 28, 2016
@nylen nylen deleted the update/wp-api-new-urls branch March 28, 2016 19:47
@nylen nylen mentioned this pull request Mar 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants