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

Make ApiBaseUrl support WPCom API endpoint #267

Closed
wants to merge 2 commits into from

Conversation

crazytonyli
Copy link
Contributor

This PR makes minimal changes to ApiBaseUrl, to make it be able to return https://public-api.wordpress.com/wp/v2 URLs (see this blog for details about the URL structure comparing to .org REST API endpoints).

Let me know what you think. I'll add more changes to make API client types support WP.com site, if you think this direction is worth perusing.

@jkmassel
Copy link
Contributor

We're avoiding adding any WordPress.com-specific code to this repo – we can do the same thing by storing the API root for the site (and allowing injection of tokens).

Probably best to mock this up on the Swift side then lower it into this repo?

@crazytonyli
Copy link
Contributor Author

Do you mind explaining what you mean by "storing the API root for the site"? Like using https://public-api.wordpress.com/wp/v2/sites/<host>/ as ApiBaseUrl to create WpApiClient instances?

@jkmassel
Copy link
Contributor

Do you mind explaining what you mean by "storing the API root for the site"? Like using https://public-api.wordpress.com/wp/v2/sites// as ApiBaseUrl to create WpApiClient instances?

Yeah, exactly – we'd pass https://public-api.wordpress.com/wp/v2/sites/123456 as the ApiBaseUrl, and we'd get that by running the autodiscovery process on the site URL (which would give us that root).

@jkmassel jkmassel deleted the support-wpcom-api-wp-v2 branch November 20, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants