Source = Json.Document(Web.Contents("",Headers=])), The first function contains the API call with an input parameter for the starting_after ID. The second function is optional, but you may find it useful as the time values in the API response are listed as Unix timestamps and you probably want to convert them to datetime values. I ended up creating one query and two functions to accomplish my goal. You cannot put the iterations and the Web.Contents call and the generated list all in one query if you want to use scheduled refresh. This blog post from Gil Raviv gave me some ideas where to start, but the code in that blog will not refresh in. To get the next page of contacts, the API call would be. The cursor used for pagination in the Intercom API as retrieved using Power Query Data returned in the Power Query Editor when retrieving contacts from the Intercom APIĮxpanding the next record gives you page 2 with a starting_after ID. Expanding the pages record shows the current page, the number of contacts per page, and the total number of pages. When you make the initial call, the API will return a JSON object that contains a total count of contacts and a record for pages. If you have more than 150 contacts, you will need to handle the cursor-based pagination. In the query string, you can specify the number of contacts per page by specifying per_page=x where x is a number less than or equal to 150. You must make an HTTP GET call to and pass an access token and Accept:application/json in the headers. In version 2.4 of the Intercom API, users are a type of contact. Chris Webb’s blog is a great source for this info, if you find yourself stuck with a query that works in Power BI Desktop but not in the service. If you have worked with the Web.Contents function in Power Query, you may be familiar with all the various ways you can use it that aren’t supported in a refresh on. I needed this query to be refreshable in so I could schedule a daily refresh.Intercom’s API uses cursor-based pagination when retrieving contacts.I faced two challenges in getting this code to work: While I will probably import the data using Data Factory or a function in the long term, I needed to pull some quick data in a refreshable manner to combine with other data already available in Power BI. I needed to pull some user data for an app that uses Intercom.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |