wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Marketplace search: return all relevant fields from API

Open gcsecsey opened this issue 3 years ago • 2 comments

Currently, if no fields are specified, the API returns only the date, post_id, and blog_id fields. To avoid having to add the fields to each request as query params, we should update the default fields to include all plugin fields.

Currently, to fetch all plugin fields, we need to make this request from calypso: https://public-api.wordpress.com/rest/v1.3/marketplace/search?http_envelope=1&fields[]=blog_icon_url&fields[]=comment_count&fields[]=plugin.excerpt&fields[]=like_count&fields[]=modified&fields[]=modified_gmt&fields[]=plugin.title&fields[]=author&fields[]=plugin.author&fields[]=author_login&fields[]=blog_id&fields[]=date&fields[]=date_gmt&fields[]=permalink.url.raw&fields[]=post_id&fields[]=post_type&fields[]=slug&fields[]=plugin.tested&fields[]=plugin.stable_tag&fields[]=plugin.active_installs&fields[]=plugin.support_threads&fields[]=plugin.support_threads_resolved&fields[]=plugin.rating&fields[]=plugin.num_ratings&fields[]=plugin.icons&page_handle=ZnJvbT0yMCZhbGc9bWFya2V0cGxhY2UlM0FzZWFyY2glMkYxJnNlc3Npb25faWQ9emFyZW5v&query=ecommerce&sort=score_default&size=20&lang=en&group_id=wporg

Let's update the default set of fields, so that we don't have to always specify the fields in the URL, eg. the above request could be: https://public-api.wordpress.com/rest/v1.3/marketplace/search?http_envelope=1&page_handle=ZnJvbT0yMCZhbGc9bWFya2V0cGxhY2UlM0FzZWFyY2glMkYxJnNlc3Npb25faWQ9emFyZW5v&query=ecommerce&sort=score_default&size=20&lang=en&group_id=wporg

gcsecsey avatar Jun 22 '22 10:06 gcsecsey

Is this still relevant?

cpapazoglou avatar Sep 22 '22 07:09 cpapazoglou

Yes, this is about updating the set of fields returned from the API by default, so we wouldn't have to build the fields params in Calypso. I've updated the description to clarify this a bit.

gcsecsey avatar Sep 22 '22 08:09 gcsecsey