none
Power Query - M language Questions RRS feed

  • Question

  • 

    Hi,  Wer have pulled data from a restful api and that give us the session information, we are then wanting to use that information to pull more infromation out.

     

    My question is how would you reference and array within M and have two 'LETS'... see below for code.

     

    let
         apiUrl = "https://api.secondstreetapp.com/sessions",
         data ="{'sessions':[{'username':'**', 'password': '**'}]}",
         options = [
                      Headers =[#"Content-Type"="application/json", #"X-Api-Key"="*****"],
                      Content = Text.ToBinary(data)
                   ],
         Value = Web.Contents(apiUrl,options),
        #"Imported JSON" = Json.Document(Value,65001),
        sessions = #"Imported JSON"[sessions],
        sessions1 = sessions{0}
    in
        sessions1
    
    let
        apiUrl = "https://api.secondstreetapp.com/message_campaigns?statusTypeId=1",
         options = [
                      Headers =[#"Content-Type"="application/json", #"X-Api-Key"="*****", #"Authorization"=sessions1.access_token, #"X-Organization-Id"=sessions1.organizationid]
                   ],
         Value = Web.Contents(apiUrl,options)
    in
         Value

    So im also wanting to know how to access the 'access_token' and 'organizationid' in the sessions1 array.

     

    Thanks


    • Edited by JaK82 Wednesday, April 12, 2017 8:11 AM
    Wednesday, April 12, 2017 8:11 AM

All replies

  • Hi JaK82,

    Thanks for visiting our forum.

    Then this forum mainly focus on general questions and feedback about Excel client. As per your specific query about Power Query and M language, it is suggested to post to the following dedicated Power Query forum for better response:

    https://social.technet.microsoft.com/Forums/en-us/home?forum=powerquery

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Your understanding is highly appreciated.

    Best regards,
    Yuki Sun


    Please remember to mark the replies as answers if they helped.

    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, April 13, 2017 2:38 AM
    Moderator