none
Can't pass "Authorization: Bearer" header using Power Query RRS feed

  • Question

  • Trying to send the following query:

    let   
    actualUrl = "https://api.automatic.com/trip",   
    options = [Headers =[#"Authorization"="Bearer <<masked for privacy>>"]],   
    result = Web.Contents(actualUrl, options) 
    in   
    result

    But Power Query returns the error "The credentials provided are invalid". What am I doing wrong?

    Monday, February 29, 2016 8:12 PM

Answers

  • Not sure if this will be of much help to you.  Here's an api query I setup to use map quest's api.  I set it up over a year ago and don't recall the details of how I got it to work.  Maybe you can adapt some of it to your needs.  

    let
        fnMapquestQuery = (Address) =>
    let
        Custom1 = (Web.Contents("http://open.mapquestapi.com/geocoding/v1/address",
    [Query=
    [#"key"="<<masked for privacy>>",
    #"thumbMaps"="false",
    #"location"=Text.From(Address)
    ]])),
        #"Imported JSON" = Json.Document(Custom1),
        results = #"Imported JSON"[results],
        results1 = results{0},
        locations = results1[locations],
        locations1 = locations{0},
        latLng = locations1[latLng],
        lat = latLng[lat],
        lng = latLng[lng],
        geocodeQuality = locations1[geocodeQuality],
        geocodeQualityCode = locations1[geocodeQualityCode],
        res = Text.From(lat) & "|" & Text.From(lng) & "|" & Text.From(geocodeQuality) & "|" & Text.From(geocodeQualityCode)
    in
        res
    in
        fnMapquestQuery



    Tuesday, March 1, 2016 4:46 PM
  • I would recommend using Fiddler or a similar tool to see the actual HTTP request being made and the response that comes back from the server.
    Wednesday, March 2, 2016 3:14 PM

All replies

  • Not sure if this will be of much help to you.  Here's an api query I setup to use map quest's api.  I set it up over a year ago and don't recall the details of how I got it to work.  Maybe you can adapt some of it to your needs.  

    let
        fnMapquestQuery = (Address) =>
    let
        Custom1 = (Web.Contents("http://open.mapquestapi.com/geocoding/v1/address",
    [Query=
    [#"key"="<<masked for privacy>>",
    #"thumbMaps"="false",
    #"location"=Text.From(Address)
    ]])),
        #"Imported JSON" = Json.Document(Custom1),
        results = #"Imported JSON"[results],
        results1 = results{0},
        locations = results1[locations],
        locations1 = locations{0},
        latLng = locations1[latLng],
        lat = latLng[lat],
        lng = latLng[lng],
        geocodeQuality = locations1[geocodeQuality],
        geocodeQualityCode = locations1[geocodeQualityCode],
        res = Text.From(lat) & "|" & Text.From(lng) & "|" & Text.From(geocodeQuality) & "|" & Text.From(geocodeQualityCode)
    in
        res
    in
        fnMapquestQuery



    Tuesday, March 1, 2016 4:46 PM
  • I would recommend using Fiddler or a similar tool to see the actual HTTP request being made and the response that comes back from the server.
    Wednesday, March 2, 2016 3:14 PM