Retrieving mots popular posts via APISOLVE
May 14, 2019 1:25 PM
Need some guidance figuring out a solution for this task:
I have tried creating a dev account, but I'm not sure if it being tied to my account would work, or if it needs to be created from my colleague's account. Just not sure what the next steps should be, so any assistance would be greatly appreciated!
Posted this originally in the CMS Development forum, but realized this it was probably better suited to this forum.
Thanks in advance,
Solved! Go to Solution.
May 15, 2019 3:29 AM
Hi @JeffreyPia , to pull the most popular posts tracked in HubSpot, assuming popular means the highest number of views, the endpoint you can use is this https://developers.hubspot.com/docs/methods/analytics/get-analytics-data-by-object. The object_type should be pages and you can add query params as filters to the endpoint e.g. &sort=rawViews.
In order to use the endpoint to get the data from the portal your colleague has access to, the authentication needed in the endpoint is either a hapikey or OAuth access token. Hapikey can be obtained from the portal - see here. For OAuth you will need a developer portal to create an app, then install the app on the portal for it to work - more info here. So depending on how you are looking to develop the solution, either way would work.