Switch Idea Hub module REST routes to actually use Idea Hub API
See original GitHub issueNow that the Idea Hub API client library code is available, Site Kit should actually start using the API.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The
Idea_Hub
class should have its REST data points that are intended to proxy through requests to the Idea Hub API updated to actually use the API. The necessary PHP client service classes are included in Site Kit via #3517.- The class needs to implement the
setup_services
method, to bootstrap a singleideahub
service, which should be this class. - The
get_datapoint_definitions
method needs to be modified to reference the newideahub
service for all data points that use the API (GET:new-ideas
,GET:saved-ideas
,POST:update-idea-state
). - The three above endpoints need to be connected to the respective Idea Hub API endpoint:
- For
GET:new-ideas
andGET:saved-ideas
, remove the hard-coded return values and instead use https://github.com/googleapis/google-api-php-client-services/blob/master/src/Google/Service/Ideahub/Resource/PlatformsPropertiesIdeas.php, passingsitekit
for platform and the URL-encoded current site’s URL (“reference site URL”) for property. In order to only return new ideas, thefilter
option needs to be used, passing a string “saved(false)”. In order to only return saved ideas, thefilter
option needs to be used, passing a string “saved(true)”. ForPOST:update-idea-state
, use https://github.com/googleapis/google-api-php-client-services/blob/master/src/Google/Service/Ideahub/Resource/PlatformsPropertiesIdeaStates.php, passing platform and property as mentioned above and the received idea name as the “ideaState” placeholder in the path. The data point should expect a single variableideaState
which needs to be an object / associative array withname
(idea name string, also used in the path as mentioned right above),saved
(boolean) anddismissed
(boolean) fields.
- For
- The class needs to implement the
Implementation Brief
- Add a
protected function setup_services
to theIdea_Hub
class that creates a new instance of Google_Service_Ideahubto be used in the instance of
Idea_Hub`. - Modidy the existing
get_datapoint_definitions
in theIdea_Hub
class so that the following point toarray( 'service' => 'ideahub' )
:GET:new-ideas
GET:saved-ideas
POST:update-idea-state
- See ACs for the implementation of each endpoint, as the ACs outline the implementation quite well.
Test Coverage
- Existing tests should pass, but no new tests needed.
Visual Regression Changes
- N/A
QA Brief
- Activate Idea Hub module
- Set the custom site URL setting in the Site Kit developer settings to
https://www.elasticpress.io/
- Go to the dashboard and verify that you see new ideas
- Also check that you can create a draft post using a new idea and that idea won’t re-appear in the new ideas list once you refresh the dashboard page.
Changelog entry
- Update Idea Hub to use the production API.
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Idea Hub API Client Library for .NET
This page contains information about getting started with the Idea Hub API by using the Google API Client Library for .NET.
Read more >Build and sell your own API $$$ (super simple!) - YouTube
... how to make a profitable API and sell it on the RapidAPI Hub.00... ... ___ ⭐ Use promo code ANIAKUBOW for 3...
Read more >REST API reference
You can use REST interfaces to access data on your instance. ... The AWA Routing API provides endpoints to route a document to...
Read more >Tutorial to Create a Rest.li Server and Client
Quickstart - A step by step tutorial introduction to Rest.li. ... Using Idea or Eclipse is a handy way to explore and follow...
Read more >How To Build a REST API with Prisma and PostgreSQL
Prisma is an open source database toolkit. In this tutorial, you will build a REST API for a small blogging application in TypeScript...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@eugene-manuilov Just two tiny updates here:
platform
is “sitekit” instead of “SITEKIT” what I had in the ACs earlier. If one doesn’t work, please try out the other, just to make sure 😃property
needs to be URL-encoded since it is a URL which is part of a regular URL path. That probably would have come up during the implementation anyway, but I just updated the ACs to clarify.@eugene-manuilov Per our Slack conversation, I’ve reduced the scope of this issue to no longer include any changes to
POST:update-idea-state
. This is now broken out into #3747.