For a couple of months now I’ve been using Power Query to get data from the Hubspot API. I have a query which gets all engagements. This was working fine but for a few days now has been returning a 500 Internal Server after several rounds of pagination. Other calls such as to the Get All Companies API work ok
Query Function below:
________________
et
Pagination = List.Skip(List.Generate( () => [IsMore = null, Last_Key = 0, Counter = 0], // Start Value
each [IsMore] <> false,// Whilst this is true, keep going
each [WebCall = Json.Document(Web.Contents(“https://api.hubapi.com”,
[
RelativePath=“engagements/v1/engagements/paged?hapikey=***&limit=250&offset=” & Text.From([Last_Key])
]
)),
Last_Key = try [WebCall][#“offset”] otherwise 0,
IsMore = if [Counter] < 1 then null else [WebCall][#“hasMore”],
Counter = [Counter]+1,
Table = Table.FromRecords(WebCall[results])
]
,each [Table] // selector
) ,1),
Custom1 = Table.Combine(Pagination),
The error message shown is:
DataSource.Error: Web.Contents failed to get contents from ‘https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=***&limit=250&offset=1581446265’ (500): Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=https://api.hubapi.com/engagements/v1/engagements/paged
Url=https://api.hubapi.com/engagements/v1/engagements/paged?hapikey=***&limit=250&offset=1581446265