Add wp.com POST /sites/<site_id>/domains/primary endpoint#1392
Open
oguzkocer wants to merge 2 commits into
Open
Add wp.com POST /sites/<site_id>/domains/primary endpoint#1392oguzkocer wants to merge 2 commits into
POST /sites/<site_id>/domains/primary endpoint#1392oguzkocer wants to merge 2 commits into
Conversation
Adds an endpoint for setting a site's primary domain. The request body
carries a single `domain` field and the response is `{ "success": bool }`.
- `SetPrimaryDomainParams` / `SetPrimaryDomainResponse` types in `domains.rs`
- `SetPrimary` `POST` variant on `DomainsRequest` (`RestV1.1`) + URL unit test
- Idempotent `domains::set_primary` e2e test that reads the current primary
domain and sets it again, exercising the endpoint without mutating the
test site's effective primary
- Changelog entry and checklist update
Collaborator
XCFramework BuildThis PR's XCFramework is available for testing. Add to your .package(url: "https://github.com/automattic/wordpress-rs", branch: "pr-build/1392")Built from 5f2a563 |
crazytonyli
reviewed
Jun 16, 2026
| #[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)] | ||
| pub struct SetPrimaryDomainResponse { | ||
| /// Whether the primary domain was set successfully. | ||
| pub success: bool, |
Contributor
There was a problem hiding this comment.
What if success is false? I remember some WP.com API would return error message and code in the response. Not sure about this one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the
POST /rest/v1.1/sites/<site_id>/domains/primary/endpoint for setting a site's primary domain. The request body carries a singledomainfield, and the response is{ "success": bool }. Used after a successful domain registration to designate the newly registered domain as the site's primary.Changes
SetPrimaryDomainParams(request body, singledomain: DomainNamefield) andSetPrimaryDomainResponse(success: bool) types indomains.rsSetPrimaryPOSTvariant on theDomainsRequestenum, served from theRestV1.1namespacedomains::set_primarye2e test: reads the site's current primary domain viasite_domainsand sets it again, so the endpoint is exercised against the live test site without changing its effective primary domainChangelog
CHANGELOG.mdunder## [Unreleased], using the Keep a Changelog categories (Added,Changed,Deprecated,Removed,Fixed,Security). Prefix breaking changes with**BREAKING:**.