APIs & Integrations

cfluharty
Participant

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Hello! I am working on an integration for my company's client and need some help figuring out an issue, specifically, I am having some trouble getting the list of landing pages from the "List Pages" (/content/api/v2/pages) endpoint.

 

As you can see in the below http session, I am getting a response successfully, but with 0 results.

 

< GET /content/api/v2/pages HTTP/1.1
< Host: api.hubapi.com
< Connection: keep-alive
< Accept-Encoding: gzip, deflate
< Accept: */*
< User-Agent: python-requests/2.13.0
< Authorization: Bearer CIu**************************************************************************************************************************5A6
<

> HTTP/1.1 200 OK
> Date: Thu, 24 Oct 2019 16:13:01 GMT
> Content-Type: application/json;charset=utf-8
> Content-Length: 47
> Connection: keep-alive
> Set-Cookie: __cfduid=d0f*************************************581; expires=Fri, 23-Oct-20 16:13:01 GMT; path=/; domain=.hubapi.com; HttpOnly
> X-Trace: 2B2******************************************************000
> Vary: Accept-Encoding
> Access-Control-Allow-Credentials: false
> CF-Cache-Status: DYNAMIC
> Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
> Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
> Server: cloudflare
> CF-RAY: 52ad3c567ecd7b0a-MCI
>
{"limit":100,"objects":[],"offset":0,"total":0}

This appears at odds with the UI though, where I can see analytics for seemingly extant landing pages:

Screenshot_2019-10-24_12-02-11.png

(Grabbed from https://app.hubspot.com/analytics/1*****0/content?metric=rawViews&pageType=landing-pages)

 

For reference though, in my attempts to verify the existence of these landing pages, I found that at least some parts of the UI do not allow the account which I created the oauth credentials with to see the landing pages. For exampleScreenshot_2019-10-24_12-05-53.png

(Grabbed from https://app.hubspot.com/website/1*****0/pages/landing?campaign=all&domain=all&page=1&sort=updated&so...)

 

For reference, here are the scopes for my access token:

< GET /oauth/v1/access-tokens/CIu**************************************************************************************************************************5A6 HTTP/1.1
< Host: api.hubapi.com
< Connection: keep-alive
< Accept-Encoding: gzip, deflate
< Accept: */*
< User-Agent: python-requests/2.13.0
< Authorization: Bearer CIu**************************************************************************************************************************5A6
<

> HTTP/1.1 200 OK
> Date: Thu, 24 Oct 2019 16:32:56 GMT
> Content-Type: application/json;charset=utf-8
> Transfer-Encoding: chunked
> Connection: keep-alive
> Set-Cookie: __cfduid=dd6*************************************776; expires=Fri, 23-Oct-20 16:32:56 GMT; path=/; domain=.hubapi.com; HttpOnly
> X-Trace: 2B5******************************************************000
> Vary: Accept-Encoding, User-Agent
> Content-Encoding: gzip
> Access-Control-Allow-Credentials: false
> CF-Cache-Status: DYNAMIC
> Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
> Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
> Server: cloudflare
> CF-RAY: 52ad598108007b0a-MCI
>
{"token":"CIu**************************************************************************************************************************5A6","user":"a**********r@t******a.com","hub_domain":"t******a.com","scopes":["contacts","content","social","automation","timeline","oauth"],"hub_id":1*****0,"app_id":3***5,"expires_in":20079,"user_id":4*****4,"token_type":"access"}

 

Given those details, is this discrepancy a result of:
- my request missing some parameter?
- my access_token missing some scope?

- the account that created this access token lacking permissions? (this seems the most likely, but it also seems odd that there is no permissions error given by the API)

2 Accepted solutions
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Hi, all. Apologies for the delayed response.

 

Thanks for jumping in, @kendrickto. I've replied to your related post here.

 

I am able to reproduce this behavior in my own account. Requests authenticated with API keys return landing page data while the same requests using OAuth tokens have empty objects arrays.

 

I'll loop in the relevant engineering team to get this resolved as soon as possible.

Isaac Takushi

Associate Certification Manager

View solution in original post

IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Hi, all.

 

This should now be resolved! Apologies for the disruption.

 

The changes should have propagated by now, but if  you're still encountering the issue, please refresh your access token and try again.

Isaac Takushi

Associate Certification Manager

View solution in original post

6 Replies 6
kendrickto
Participant

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

I'm running into the same issue with our HubSpot integration, when testing it seems that if you use the api key for authorization instead of the Oauth token flow it pulls the landing pages. Hopefully that helps you out a bit, unfortunately I do not know why the token receives the empty response either.

cfluharty
Participant

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Interesting! At least I now know I'm not the only one experiencing this issue.

 

Unfortunately, at this time I do not have an api key, or the ability to get one from the UI, so I can't yet confirm if I'm experiencing the same issue, but if/when I can, I'll update here.

 

In the mean time I've +1'd your question in hopes that it might draw the attention of any moderators here, becase while an api key may work for development, it is certainly isn't ideal for our clients.

kendrickto
Participant

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Same here! We've had our system built to use OAuth for a couple years now and we would have to go back and ask our clients to change and generate an api key in HubSpot

IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Hi, all. Apologies for the delayed response.

 

Thanks for jumping in, @kendrickto. I've replied to your related post here.

 

I am able to reproduce this behavior in my own account. Requests authenticated with API keys return landing page data while the same requests using OAuth tokens have empty objects arrays.

 

I'll loop in the relevant engineering team to get this resolved as soon as possible.

Isaac Takushi

Associate Certification Manager
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Hi, all.

 

This should now be resolved! Apologies for the disruption.

 

The changes should have propagated by now, but if  you're still encountering the issue, please refresh your access token and try again.

Isaac Takushi

Associate Certification Manager
cfluharty
Participant

"List Pages" (/content/api/v2/pages) endpoint not giving results {"objects":[], "total":0}

SOLVE

Thank you (for the solution, and the quick turnaround)!

 

I have just confirmed that this endpoint is returning data again for my credential