<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Connecting NewBook REST API to Power BI in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071541#M61007</link>
    <description>&lt;P&gt;Shouldn't that say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;#"Authorization" = "Bearer " &amp;amp; Token&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Sep 2021 02:35:14 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2021-09-13T02:35:14Z</dc:date>
    <item>
      <title>Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071423#M61001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a power query to connect NewBook Rest API with Power BI but no luck so far. Doesn't matter what I try I keep ending with the same errors:&lt;/P&gt;&lt;P&gt;"Use Anonymous for Web.contents' and if I use anonymous then "Couldn't authenticate using these credentials.&lt;/P&gt;&lt;P&gt;Any help will be much appreciated.&lt;/P&gt;&lt;P&gt;Rest API documentation is found here:&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://developers.newbook.cloud/rest.php" target="_self"&gt;https://developers.newbook.cloud/rest.php&amp;nbsp;&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Below is my code snippet&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;BaseUrl = "&lt;A href="https://api.newbook.cloud/rest/" target="_blank" rel="noopener"&gt;https://api.newbook.cloud/rest/&lt;/A&gt;",&lt;BR /&gt;// Get Basic Auth Token using &lt;A href="https://www.debugbear.com/basic-auth-header-generator" target="_blank" rel="noopener"&gt;https://www.debugbear.com/basic-auth-header-generator&lt;/A&gt; and username / password&lt;BR /&gt;Token = "Replace_with_Basic_Auth_Header_Random_String_Only",&lt;BR /&gt;NB_Region = "au",&lt;BR /&gt;NB_APIKey = "Replace_with_API_Key",&lt;BR /&gt;EntitiesPerPage = 500,&lt;BR /&gt;&lt;BR /&gt;GetJson = (Url,PageOffset) =&amp;gt;&lt;BR /&gt;let body = "{&lt;BR /&gt;""api_key"": """&amp;amp; NB_APIKey &amp;amp;""",&lt;BR /&gt;""region"": """&amp;amp; NB_Region &amp;amp;""",&lt;BR /&gt;""request_action"": ""instances_list"",&lt;BR /&gt;""data_offset"": """&amp;amp; Text.From(PageOffset)&amp;amp;""",&lt;BR /&gt;""data_limit"": """&amp;amp; Text.From(EntitiesPerPage)&amp;amp;"""&lt;BR /&gt;}",&lt;BR /&gt;Options = [Headers=[ #"Authorization" = "Basic " &amp;amp; Token, #"Content-Type" = "application/json" ], Content=Text.ToBinary(body)],&lt;BR /&gt;Json = Json.Document(Web.Contents("&lt;A href="https://api.newbook.cloud/" target="_blank" rel="noopener"&gt;https://api.newbook.cloud/&lt;/A&gt;", [Headers=[ #"Authorization" = "Basic " &amp;amp; Token, #"Content-Type" = "application/json" ], Content=Text.ToBinary(body), RelativePath="rest"]))&lt;BR /&gt;in Json,&lt;BR /&gt;&lt;BR /&gt;GetEntityCount = () =&amp;gt;&lt;BR /&gt;let Url = BaseUrl,&lt;BR /&gt;Json = GetJson(Url,0),&lt;BR /&gt;Count = Json[#"data_total"]&lt;BR /&gt;in Count,&lt;BR /&gt;&lt;BR /&gt;GetPage = (Index) =&amp;gt;&lt;BR /&gt;let Skip = Text.From(Index * EntitiesPerPage),&lt;BR /&gt;Url = BaseUrl,&lt;BR /&gt;Json = GetJson(Url,Skip),&lt;BR /&gt;Value = Json[#"data"]&lt;BR /&gt;in Value,&lt;BR /&gt;&lt;BR /&gt;EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }),&lt;BR /&gt;PageCount = Number.RoundUp(Number.From(EntityCount) / EntitiesPerPage),&lt;BR /&gt;PageIndices = { 0 .. PageCount - 1 },&lt;BR /&gt;Pages = List.Transform(PageIndices, each GetPage(_)),&lt;BR /&gt;Entities = List.Union(Pages),&lt;BR /&gt;#"Converted to Table" = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Table"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 01:54:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071423#M61001</guid>
      <dc:creator>KKailly</dc:creator>
      <dc:date>2021-09-13T01:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071541#M61007</link>
      <description>&lt;P&gt;Shouldn't that say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;#"Authorization" = "Bearer " &amp;amp; Token&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 02:35:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071541#M61007</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-09-13T02:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071621#M61010</link>
      <description>&lt;P&gt;Hi Ibendlin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try that but still no luck.&lt;/P&gt;&lt;P&gt;If I select anonymous it says couldn't authenticate using these credentials and if I select Basic, it says can only connect using anonymous.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 03:02:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2071621#M61010</guid>
      <dc:creator>KKailly</dc:creator>
      <dc:date>2021-09-13T03:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2072832#M61031</link>
      <description>&lt;P&gt;Your body line does not seem to have the right syntax.&amp;nbsp; It is easier to generate your content with this approach instead and then use Json.FromValue to convert it to JSON syntax for your web call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;body = [&lt;BR /&gt;api_key = NB_APIKey,&lt;BR /&gt;region = NB_Region,&lt;BR /&gt;request_action = "instances_list",&lt;BR /&gt;data_offset = Text.From(PageOffset),&lt;BR /&gt;data_limit = Text.From(EntitiesPerPage)],&lt;BR /&gt;bodyjson = Json.FromValue(body),&lt;BR /&gt;in&lt;/P&gt;
&lt;P&gt;bodyjson&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 12:49:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2072832#M61031</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2021-09-13T12:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2084820#M61411</link>
      <description>&lt;P&gt;Hi Pat,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the tip but I still keep getting one of the authentication errors i.e. can only use anonymous for web.contents and if switched to anonymous then couldn't authenticate with credentials provided. I'm still learning to write queries so it is possible that I'm making some silly mistake.&lt;/P&gt;&lt;P&gt;This is my code as of now:&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;BaseUrl = "&lt;A href="https://api.newbook.cloud/rest/" target="_blank"&gt;https://api.newbook.cloud/rest/&lt;/A&gt;",&lt;BR /&gt;Token = "&lt;SPAN&gt;Replace_with_Basic_Auth_Header_Random_String_Only&lt;/SPAN&gt;",&lt;BR /&gt;NB_Region = "au",&lt;BR /&gt;NB_APIKey = "My API Key",&lt;BR /&gt;EntitiesPerPage = 500,&lt;BR /&gt;&lt;BR /&gt;GetJson = (Url,PageOffset) =&amp;gt;&lt;BR /&gt;let body = [&lt;BR /&gt;api_key = NB_APIKey,&lt;BR /&gt;region = NB_Region,&lt;BR /&gt;request_action = "instances_list",&lt;BR /&gt;data_offset = Text.From(PageOffset),&lt;BR /&gt;data_limit = Text.From(EntitiesPerPage)],&lt;BR /&gt;bodyjson = Json.FromValue(body),&lt;BR /&gt;Json = Json.Document(Web.Contents("&lt;A href="https://api.newbook.cloud/" target="_blank"&gt;https://api.newbook.cloud/&lt;/A&gt;", [Headers=[ #"Authorization" = "Bearer " &amp;amp; Token, #"Content-Type" = "application/json" ], Content=bodyjson, RelativePath="rest"]))&lt;BR /&gt;in Json,&lt;BR /&gt;&lt;BR /&gt;GetEntityCount = () =&amp;gt;&lt;BR /&gt;let Url = BaseUrl,&lt;BR /&gt;Json = GetJson(Url,0),&lt;BR /&gt;Count = Json[#"data_total"]&lt;BR /&gt;in Count,&lt;BR /&gt;&lt;BR /&gt;GetPage = (Index) =&amp;gt;&lt;BR /&gt;let Skip = Text.From(Index * EntitiesPerPage),&lt;BR /&gt;Url = BaseUrl,&lt;BR /&gt;Json = GetJson(Url,Skip),&lt;BR /&gt;Value = Json[#"data"]&lt;BR /&gt;in Value,&lt;BR /&gt;&lt;BR /&gt;EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }),&lt;BR /&gt;PageCount = Number.RoundUp(Number.From(EntityCount) / EntitiesPerPage),&lt;BR /&gt;PageIndices = { 0 .. PageCount - 1 },&lt;BR /&gt;Pages = List.Transform(PageIndices, each GetPage(_)),&lt;BR /&gt;Entities = List.Union(Pages),&lt;BR /&gt;#"Converted to Table" = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Table"&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 00:47:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2084820#M61411</guid>
      <dc:creator>KKailly</dc:creator>
      <dc:date>2021-09-20T00:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2101930#M61950</link>
      <description>&lt;P&gt;Thank you everyone for your input, I finally figured it out.&lt;/P&gt;&lt;P&gt;This code worked for me:&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;BaseUrl = "&lt;A href="https://api.newbook.cloud/rest/" target="_blank"&gt;https://api.newbook.cloud/rest/&lt;/A&gt;",&lt;BR /&gt;// Get Basic Auth Token using &lt;A href="https://www.debugbear.com/basic-auth-header-generator" target="_blank"&gt;https://www.debugbear.com/basic-auth-header-generator&lt;/A&gt; and username / password&lt;BR /&gt;Token = "&amp;lt;Generated Token&amp;gt;",&lt;BR /&gt;NB_Region = "au",&lt;BR /&gt;NB_APIKey = "&amp;lt;API Key&amp;gt;",&lt;BR /&gt;body = "{&lt;BR /&gt;""api_key"": """&amp;amp; NB_APIKey &amp;amp;""",&lt;BR /&gt;""region"": """&amp;amp; NB_Region &amp;amp;""",&lt;BR /&gt;""request_action"": ""bookings_list"",&lt;BR /&gt;""list_type"":""staying"",&lt;BR /&gt;""period_from"":""2019-01-01"",&lt;BR /&gt;""period_to"":""2023-12-31""&lt;BR /&gt;}",&lt;BR /&gt;Json = Json.Document(Web.Contents("&lt;A href="https://api.newbook.cloud/" target="_blank"&gt;https://api.newbook.cloud/&lt;/A&gt;", [Headers=[ #"Authorization" ="Basic " &amp;amp; Token, #"Content-Type" = "application/json" ], Content=Text.ToBinary(body), RelativePath="rest"]))&lt;/P&gt;&lt;P&gt;in Json&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 05:23:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/2101930#M61950</guid>
      <dc:creator>KKailly</dc:creator>
      <dc:date>2021-09-28T05:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/3007297#M95247</link>
      <description>&lt;P&gt;Hi Folk,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know its been a while, but has anyone got this working more recently after the changes to base URL's in the NewBook API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jan 2023 07:31:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/3007297#M95247</guid>
      <dc:creator>prospitality</dc:creator>
      <dc:date>2023-01-08T07:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting NewBook REST API to Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/3724796#M122382</link>
      <description>&lt;P&gt;I'm using Postman to fiddle with authentication but I keep getting a "&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Newbook REST API authentication incorrect (username or password)" error and&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I'm curious if there is something obvious that I'm missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;URL:&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://api.newbook.cloud/rest/api_keys" target="_blank" rel="noopener"&gt;https://api.newbook.cloud/rest/api_keys&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Method: POST&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Authentication: Postman allows you to input your username and password it generates a Basic Auth token and inserts it into the request headers under "Authorization": "Basic XXXXXXXXXXXXXXXXXXX"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas on why I can't get it authenticate correctly?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 18:24:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Connecting-NewBook-REST-API-to-Power-BI/m-p/3724796#M122382</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-26T18:24:21Z</dc:date>
    </item>
  </channel>
</rss>

