none
Invalid Identifier in Power Query RRS feed

  • Question

  • Hi, 

    I am getting an error as Invalid Identifier in Power Query while pulling web content using API. Please suggest to run below script successfully.

    let

    Source = Web.Page(Web.Contents(“https://api.twitter.com/1.1/search/tweets.json?q=spotfire?, 
    [Headers=[#”Authorization”=”OAuth oauth_consumer_key=”@@@”, oauth_nonce=”@@@”, 
    oauth_signature=”@@@”, oauth_signature_method=”@@@”, oauth_timestamp=”@@@”, 
    oauth_token=”@@@”, oauth_version=””1.0?””]]))

    in
    Source

    Regards

    Ram

    Friday, February 19, 2016 1:07 PM

Answers

  • Are you escaping the quotes inside of the Authorization value? You can escape double-quotes by putting it twice in a row like so:"OAuth oauth_consumer_key=""@@@"", oauth..."

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:53 AM
    Friday, February 19, 2016 7:27 PM
  • ""1.0?"" might be causing the failure. If you want to escape the ", you can do this: """1.0?"""

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:54 AM
    Saturday, February 20, 2016 1:52 AM
    Moderator
  • You haven't doubled all of the quotes in your authorization string. The closing quote for HMAC-SHA1 has ?" instead of "", oauth_timestamp and oauth_token are still using an undoubled quote, and oauth_version is using three quotes instead of two.

    More critically, I don't think this will actually work. The OAuth 1.0a specification requires that each message be uniquely signed with a hash that can't actually be created from within Power Query today.

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:54 AM
    Monday, February 22, 2016 4:35 PM

All replies

  • Are you escaping the quotes inside of the Authorization value? You can escape double-quotes by putting it twice in a row like so:"OAuth oauth_consumer_key=""@@@"", oauth..."

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:53 AM
    Friday, February 19, 2016 7:27 PM
  • ""1.0?"" might be causing the failure. If you want to escape the ", you can do this: """1.0?"""

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:54 AM
    Saturday, February 20, 2016 1:52 AM
    Moderator
  • Thanks Alejandro,

    Let me check and wll give an update

    Saturday, February 20, 2016 6:59 AM
  • Thanks Oguz,

    Let me check and wll give an update

    Saturday, February 20, 2016 6:59 AM
  • You need to end the url with double quote which is missing --> “https://api.twitter.com/1.1/search/tweets.json?q=spotfire "

    syntax is web.contents("URL",[headers])

    Saturday, February 20, 2016 4:05 PM
  • Hi All,

    Thanks for your replies, After updating double quotes now no syntax errors but getting below error.

    Expression.Error: 2 arguments were passed to a function which expects 1.
    Details:
        Pattern=
        Arguments=List

    Below is the the code, kindly suggest.

    let
        Source = Web.Page(Web.Contents("https://api.twitter.com/1.1/search/tweets.json?q=spotfire"),[Headers=[#"Authorization"="OAuth oauth_consumer_key=""@@@"", 
    oauth_signature=""@@@"", oauth_signature_method=""HMAC-SHA1?", oauth_timestamp="@@@", 
    oauth_token="@@@", oauth_version="""1.0?"""]])
    in
        Source

    Regards

    Ram

    Monday, February 22, 2016 5:17 AM
  • Another Error as below after updating closed parenthesis

    DataFormat.Error: Specified value has invalid CRLF characters.
    Parameter name: value
    Details:
        OAuth oauth_consumer_key="@@@",oauth_nonce="@@@", 
    oauth_signature="@@@", oauth_signature_method="HMAC-SHA1?

    Note : if i removed quotes for the above parameters from the blow code i am getting Invalid Identifier error : (

    let

        Source=Web.Page(Web.Contents("https://api.twitter.com/1.1/search/tweets.json?q=spotfire",[Headers=[#"Authorization"="OAuth oauth_consumer_key=""@@@"",oauth_nonce=""389952772"", 
    oauth_signature=""@@@"", oauth_signature_method=""HMAC-SHA1?", oauth_timestamp="1455867899", 
    oauth_token="@@@", oauth_version="""1.0?"""]]))

    in
        Source


    • Edited by JanakiRam_k Monday, February 22, 2016 11:26 AM
    Monday, February 22, 2016 5:34 AM
  • You haven't doubled all of the quotes in your authorization string. The closing quote for HMAC-SHA1 has ?" instead of "", oauth_timestamp and oauth_token are still using an undoubled quote, and oauth_version is using three quotes instead of two.

    More critically, I don't think this will actually work. The OAuth 1.0a specification requires that each message be uniquely signed with a hash that can't actually be created from within Power Query today.

    • Marked as answer by JanakiRam_k Tuesday, February 23, 2016 11:54 AM
    Monday, February 22, 2016 4:35 PM
  • Hi Curt,

    Thanks for your reply, as suggested i have updated the query. but now no errors but data table not downloaded.

    Below is the updated code with no errors but returning only document with null table as elements.

    let

    source = Web.Page(Web.Contents("https://api.twitter.com/1.1/search/tweets.json?q=spotfire",[Headers=[#"Authorization"="OAuth", 
    #"oauth_consumer_key"="@@@",#"oauth_nonce"="1440311449", 
    #"oauth_signature"="@@@", #"oauth_signature_method"="HMAC-SHA1?", 
    #"oauth_timestamp"="1456200733", #"oauth_token"="@@@", #"oauth_version"="1.0"]]))

    in 
    source

    Note: I am getting invalid error if i put double quote for oauth_timestamp and oauth_token and oauth_version is using two quotes getting error but if i use " ? "i am getting below error too.

    DataSource.Error: The remote server return an HTTP status code '400' when trying to access 'https://api.twitter.com/1.1/search/tweets.json?q=spotfire'.
    Details:
        DataSourceKind=Web
        DataSourcePath=https://api.twitter.com/1.1/search/tweets.json
        Url=https://api.twitter.com/1.1/search/tweets.json?q=spotfire

    Please provide solution as from past 1 week i am very tired with this code , errors and bad results.



    Tuesday, February 23, 2016 5:00 AM
  • Hi folks,

    Can anyone help me on this to figure out the solution.

    Tuesday, February 23, 2016 10:00 AM
  • Hi Janaki

    Were you able to resolve your issue, I am stuck in almost same situation of quotes or no quotes where all logical quotes still giving me invalid identifier error.

    Tuesday, August 8, 2017 4:51 AM