Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey,
I set up a API datasource in Power BI desktop. The whole model is working fine. Once I publish the report, there seems to be an error 405 when accessing the API datasources. No idea how to fix this.
Failed to update data source credentials: Web.Contents failed to get contents from 'https://[not disclosed]' (405): Method Not AllowedHide details
Activity ID: | bcdc579a-8442-4022-9173-8e77eb6ffb1f |
Request ID: | 2a3e9e61-609c-ea03-db1a-e198a01781a7 |
Status code: | 400 |
Time: | Mon Feb 04 2019 10:41:25 GMT+0100 (Midden-Europese standaardtijd) |
Version: | 13.0.8234.157 |
Cluster URI: | https://wabi-north-europe-redirect.analysis.windows.net |
The data source is basically a function to call an API several times (because I can only call for a period of max 30days.
This is the function:
let function = (startdate as text, enddate as text) => let
Login = Json.Document(Web.Contents("https://[not disclosed]", [Headers=[#"Content-Type"="application/x-www-form-urlencoded", Accept="application/json"], Content=Text.ToBinary("username=-----&password=------&market=BE")])),
sessionId = Login[sessionId],
body = "{
""from"": """& startdate &""",
""to"": """& enddate &""",
""events"": [],
""venues"": [],
""admin"": [],
""promoter"": []
}",
Source=Json.Document(Web.Contents("https://[not disclosed]", [Headers=[#"sessionId"=sessionId, #"marketcode"="BE", Accept="application/json",#"Content-Type"="application/json"], Content=Text.ToBinary(body)])),
transactions = Source[transactions],
#"Converted to Table" = Table.FromList(transactions, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"firstName", "lastName", "middleName", "email1", "email2", "phone1", "phone2", "phone3", "phone4", "address1", "address2", "zipCode", "city", "country", "customerNumber", "preferredLang", "company", "department", "gdprFlags", "eventId", "eventCode", "eventDate", "eventTime", "eventTitle", "venueId", "venue", "promoter", "administrator", "keywords", "level", "section", "row", "seatNumber", "price", "priceCategory", "priceType", "trxHeaderCode", "transactionDate", "transactionTime", "orderNumber", "orderNote", "status", "outletCode", "outletName", "cameFromCode"}, {"Column1.firstName", "Column1.lastName", "Column1.middleName", "Column1.email1", "Column1.email2", "Column1.phone1", "Column1.phone2", "Column1.phone3", "Column1.phone4", "Column1.address1", "Column1.address2", "Column1.zipCode", "Column1.city", "Column1.country", "Column1.customerNumber", "Column1.preferredLang", "Column1.company", "Column1.department", "Column1.gdprFlags", "Column1.eventId", "Column1.eventCode", "Column1.eventDate", "Column1.eventTime", "Column1.eventTitle", "Column1.venueId", "Column1.venue", "Column1.promoter", "Column1.administrator", "Column1.keywords", "Column1.level", "Column1.section", "Column1.row", "Column1.seatNumber", "Column1.price", "Column1.priceCategory", "Column1.priceType", "Column1.trxHeaderCode", "Column1.transactionDate", "Column1.transactionTime", "Column1.orderNumber", "Column1.orderNote", "Column1.status", "Column1.outletCode", "Column1.outletName", "Column1.cameFromCode"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",{{"Column1.firstName", "firstName"}, {"Column1.lastName", "lastName"}, {"Column1.middleName", "middleName"}, {"Column1.email1", "email1"}, {"Column1.email2", "email2"}, {"Column1.phone1", "phone1"}, {"Column1.phone2", "phone2"}, {"Column1.phone3", "phone3"}, {"Column1.phone4", "phone4"}, {"Column1.address1", "address1"}, {"Column1.address2", "address2"}, {"Column1.zipCode", "zipCode"}, {"Column1.city", "city"}, {"Column1.country", "country"}, {"Column1.customerNumber", "customerNumber"}, {"Column1.preferredLang", "preferredLang"}, {"Column1.company", "company"}, {"Column1.department", "department"}, {"Column1.gdprFlags", "gdprFlags"}, {"Column1.eventId", "eventId"}, {"Column1.eventCode", "eventCode"}, {"Column1.eventDate", "eventDate"}, {"Column1.eventTime", "eventTime"}, {"Column1.eventTitle", "eventTitle"}, {"Column1.venueId", "venueId"}, {"Column1.venue", "venue"}, {"Column1.administrator", "administrator"}, {"Column1.keywords", "keywords"}, {"Column1.promoter", "promoter"}, {"Column1.level", "level"}, {"Column1.section", "section"}, {"Column1.row", "row"}, {"Column1.seatNumber", "seatNumber"}, {"Column1.price", "price"}, {"Column1.priceCategory", "priceCategory"}, {"Column1.trxHeaderCode", "trxHeaderCode"}, {"Column1.transactionDate", "transactionDate"}, {"Column1.transactionTime", "transactionTime"}, {"Column1.orderNumber", "orderNumber"}, {"Column1.orderNote", "orderNote"}, {"Column1.status", "status"}, {"Column1.outletCode", "outletCode"}, {"Column1.outletName", "outletName"}, {"Column1.cameFromCode", "cameFromCode"}})
in
#"Renamed Columns"
in
function
Hi @Nick123,
I would suggest you check if the data source supports the anonymous authentication. Because I found the error message from the log database says the credential type isn't supported. Please refer to the details below.
>>> We were unable to connect because this credential type isn't supported for this resource. Please choose another credential type.
Best Regards,
Thanks for checking. What I don't understand: in PowerBI desktop it's working fine with anonymous credentials (see below). Once it's published, it doesn't.
Hi,
Can anyone help me out on this. I urgently need to get this working, but found no solution yet.
Thanks
Was the solution found?
I have exact same problem. hope a solution is around the corner
Are you using anonymous authentication? If so, did you set your data source credentials as anonymous?
Also, the root of the URL must support anonymous authentication as well
Hi,
Thanks for the reply. The username and password are passed through the first API call (in my code, the line starting with "Login="), so I'm using anonymous authentication... which works fine in Power Bi Desktop, but once it's published, I get this error 405...
In your screenshot above, where it says "Edit credentials", you need to specify Anonymous, if you haven't done so already, and you need to ensure that the root of the URL supports anonymous authentication
This is because the power bi service will attempt to authentication the data sources, and if the root of the URL doesn't support anonymous authentication, then you will see the errors above
I already selected “anonymous”, yet no solution...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.