humanmade / humanmade/Mercator-REST-API

Add make_primary endpoint

Đang mở
#3 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
2
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

After https://github.com/humanmade/Mercator/pull/80 has been merged it might be good to add a route to call that method on a mapping

**Approach 1**

`mappings/123/make_primary`

It's a little tricky to determine what this should look like from a REST perspective though. Under the hood there's a `DELETE` (remove current mapping) and a `POST` (create mapping from previous primary domain) essentially with `wp_options` and `wp_blogs` table updates thrown in too.

I'm thinking `PUT` or `PATCH` makes the most sense. We're updating/acting upon the current mapping and `PATCH` doesn't require the object be returned.

**Approach 2**

Alternatively is it worth adding a `mappings/primary` endpoint? Or just `primary`. Feels that's something to handle in a multisite API but could be argued for adding here if it's a way of calling `make_primary()`. Would allow for more self contained UI to be built off it without other dependencies too as you need the primary domain info.

We could use the following routes as the means of getting & setting an alias to be the primary, say:
- `/mappings/primary` GET - `get_site()` result
- `/mappings/primary` POST - takes a mapping ID and calls `Mapping::make_primary()`

@rmccue thoughts?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.