Results 1 to 1 of 1

API, M code, We couldn't authenticate with the credentials provided. Please try again [PQ]

Threaded View

  1. #1
    Registered User
    Join Date
    01-11-2013
    Location
    London
    MS-Off Ver
    Excel 2013, 2016
    Posts
    95

    API, M code, We couldn't authenticate with the credentials provided. Please try again [PQ]

    Hi XL Gurus,

    I am experiencing some issue with getting data from an API (Red Hat Satellite web site) via Power Query.

    I did managed to create my query without any issue. Click on Refresh data are extracted ok.

    If I do not use my query for a week then I got the "We couldn't authenticate with the credentials provided. Please try again" message and that is where I cannot figure out what to do.

    Any asistance would be highly appreciated.


    My M code below:

    
    let
        Source = {1..4},
        #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
        Pagination = Table.AddColumn(#"Changed Type", "Custom", each Json.Document(Web.Contents("https://REDHATSATELITTE/api/job_invocations?page="&[Column1]))),
        #"Expanded Custom" = Table.ExpandRecordColumn(Pagination, "Custom", {"total", "subtotal", "page", "per_page", "search", "sort", "results"}, {"total", "subtotal", "page", "per_page", "search", "sort", "results"}),
        #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Column1", "total", "subtotal", "page", "per_page", "search", "sort"}),
        #"Expanded results" = Table.ExpandListColumn(#"Removed Columns", "results"),
        Results = Table.ExpandRecordColumn(#"Expanded results", "results", {"description", "job_category", "targeting_id", "status", "start_at", "status_label", "succeeded", "failed", "pending", "total"}, {"description", "job_category", "targeting_id", "status", "start_at", "status_label", "succeeded", "failed", "pending", "total"}),
        #"Replaced UTC" = Table.ReplaceValue(Results," UTC","",Replacer.ReplaceText,{"start_at"}),
        #"Changed type Time/Date" = Table.TransformColumnTypes(#"Replaced UTC",{{"start_at", type datetime}}),
        #"Postcheck Only" = Table.SelectRows(#"Changed type Time/Date", each ([description] = "OPR-PATCHING-POSTCHECK - NON-PROD" or [description] = "OPR-PATCHING-POSTCHECK - PROD" or [description] = "OPR-PATCHING-POSTCHECK-NON-PROD" or [description] = "OPR-PATCHING-POSTCHECK-NON-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-PROD" or [description] = "OPR-PATCHING-POSTCHECK-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-NON-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-NON-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-TEST-GROUP-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleCman-TEST-GROUP-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-NON-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-NON-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-TEST-GROUP-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-TEST-GROUP-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-NON-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-NON-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-PROD-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-TEST-GROUP-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapCluster-TEST-GROUP-D1" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapHana-NON-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapHana-PROD-D0" or [description] = "OPR-PATCHING-POSTCHECK-SPE-SapHana-TEST-GROUP-D0" or [description] = "OPR-PATCHING-POSTCHECK-TEST-GROUP" or [description] = "OPR-PATCHING-POSTCHECK-TEST-GROUP-D1")),
        #"Sorted Rows" = Table.Sort(#"Postcheck Only",{{"description", Order.Ascending}}),
        Env = Table.AddColumn(#"Sorted Rows", "Env", each if [description] = "OPR-PATCHING-POSTCHECK-TEST-GROUP" then "TEST GROUP Day 0" else if [description] = "OPR-PATCHING-POSTCHECK-TEST-GROUP-D1" then "TEST GROUP Day 1" else if [description] = "OPR-PATCHING-POSTCHECK-NON-PROD" then "NON-PROD Day 0" else if [description] = "OPR-PATCHING-POSTCHECK-NON-PROD-D1" then "NON-PROD Day 1" else if [description] = "OPR-PATCHING-POSTCHECK-PROD" then "PROD Day 0" else if [description] = "OPR-PATCHING-POSTCHECK-PROD-D1" then "PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-TEST-GROUP-D0") then "TEST GROUP Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-TEST-GROUP-D1") then "TEST GROUP Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-NON-PROD-D0") then "NON-PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-NON-PROD-D1") then "NON-PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-PROD-D0") then "PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleCman-PROD-D1") then "PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-TEST-GROUP-D0") then "TEST GROUP Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-TEST-GROUP-D1") then "TEST GROUP Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-NON-PROD-D0") then "NON-PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-NON-PROD-D1") then "NON-PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-PROD-D0") then "PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-OracleRacLan-PROD-D1") then "PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-TEST-GROUP-D0") then "TEST GROUP Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-TEST-GROUP-D1") then "TEST GROUP Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-NON-PROD-D0") then "NON-PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-NON-PROD-D1") then "NON-PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-PROD-D0") then "PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapCluster-PROD-D1") then "PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-TEST-GROUP-D0") then "TEST GROUP Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-TEST-GROUP-D1") then "TEST GROUP Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-NON-PROD-D0") then "NON-PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-NON-PROD-D1") then "NON-PROD Day 1" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-PROD-D0") then "PROD Day 0" else if Text.Contains([description], "OPR-PATCHING-POSTCHECK-SPE-SapHana-PROD-D1") then "PROD Day 1" else null),
        #"Reordered Columns" = Table.ReorderColumns(Env,{"description", "Env", "job_category", "targeting_id", "status", "start_at", "status_label", "succeeded", "failed", "pending", "total"}),
        #"Sorted Rows1" = Table.Sort(#"Reordered Columns",{{"start_at", Order.Ascending}}),
        #"Renamed Columns" = Table.RenameColumns(#"Sorted Rows1",{{"start_at", "Date"}}),
        #"Changed Type Date/Time" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type datetime}}),
        #"Filtered Rows (null)" = Table.SelectRows(#"Changed Type Date/Time", each ([Env] <> null) and ([Date] <> #datetime(2021, 3, 18, 5, 0, 0) and [Date] <> #datetime(2021, 3, 18, 5, 30, 0) and [Date] <> #datetime(2021, 3, 19, 5, 30, 0) and [Date] <> #datetime(2021, 4, 21, 4, 0, 0) and [Date] <> #datetime(2021, 4, 21, 5, 30, 0) and [Date] <> #datetime(2021, 4, 22, 4, 0, 0) and [Date] <> #datetime(2021, 4, 22, 5, 30, 0) and [Date] <> #datetime(2050, 12, 25, 5, 0, 0) and [Date] <> #datetime(2050, 12, 25, 5, 30, 0) and [Date] <> #datetime(2050, 12, 25, 6, 30, 0) and [Date] <> #datetime(2050, 12, 26, 5, 0, 0) and [Date] <> #datetime(2050, 12, 26, 5, 30, 0) and [Date] <> #datetime(2050, 12, 26, 6, 30, 0))),
        #"Grouped Rows" = Table.Group(#"Filtered Rows (null)", {"Env"}, {{"Total", each List.Sum([total]), type number}, {"Patched", each List.Sum([succeeded]), type number}, {"Not Patched", each List.Sum([failed]), type number}})
    in
        #"Grouped Rows"
    Last edited by 6StringJazzer; 03-11-2022 at 10:05 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run the code again after 1min, when "We couldn't authenticate...." window pops up
    By TK2013 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2021, 11:39 PM
  2. VBA Code does recognise value in a cell if value is provided by formula.
    By bretthullah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2019, 02:49 AM
  3. looking for sample code that upload files to SharePoint using the user credentials
    By jpandino in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2015, 05:39 PM
  4. Replies: 1
    Last Post: 02-05-2015, 05:44 PM
  5. [SOLVED] Code couldn't works
    By jackyong1985 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-19-2012, 04:54 AM
  6. Replies: 0
    Last Post: 07-20-2006, 12:20 PM
  7. [SOLVED] i couldn't open my excel files,it gives location couldn't find err
    By Hozefa in forum Excel General
    Replies: 1
    Last Post: 12-21-2005, 12:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1