Closed ivan-ottinger closed 1 year ago
I think WPCOM_REST_API_V2_Endpoint_Subscribers
would be a good place to add this code. There are already several endpoints defined in that class to get the count and import subscribers, but none to list them.
How come you'd not extend existing /sites/[site-id]/followers
API which is used to list subscribers currently?
How come you'd not extend existing
/sites/[site-id]/followers
API which is used to list subscribers currently?
I considered this. But since it's a 1.1 endpoint, and I understood that we'd like new functionality to live in the v2 namespace, I thought that the subscriber endpoint would be better a better place for it to live.
I have a WIP PR ready for this: D112832-code
Closed in D112832-code
Create API endpoint (or extend existing one if possible and worth it) that will provide all necessary information about subscribers (email subscribers, notification subscribers, paid subscribers, WPCOM and external users).
Data required:
total
(number)page
(number)pages
(number)subscribers
(array ofsubscriber
objects that will have the values listed below)user_id
(number)subscription_id
(number) - potential confusion withpaid_subscription_id
of paid subscriptionusername
(string)email_address
(string)display_name
(string) (probably Display name will be better than First / Last name) (string)avatar
(string - image URL) Gravatar / user's profile picturedate_subscribed
(string) example format2023-05-25T08:19:30+00:00
(including the timezone - format used by the "followers" endpoint) or2023-06-26 09:52:23
(without the timezone specified and in UTC - format used by the "memberships" endpoint) - date of when the user subscribedplans
(array ofplan
objects that will have the values listed below)paid_subscription_id
(number)status
(string)title
(string)currency
(string)start_date
(string)end_date
(string)As for the
plan
object, we may consider including all values that are currently outputted by the "memberships" endpoint (please see below).Existing APIs that might be helpful:
https://public-api.wordpress.com/rest/v1.1/sites/[site-id]/followers?http_envelope=1&max=100&type=all&page=1
used athttps://wordpress.com/people/subscribers/[site-address]
(People → Subscribers) pageExample output:
https://public-api.wordpress.com/wpcom/v2/sites/[site-id]/memberships/subscribers?offset=0&_envelope=1
used athttps://wordpress.com/earn/payments/[site-address]
(Tools → Earn → Manage Premium Content) pageExample output: