Forum Discussion

jumercor's avatar
jumercor
Regular Visitor
2 years ago
Solved

We cannot convert the value "[Binary]" to type Text

Hi everyone,   I'm trying to get data from hubspot API to powerbi using a POST method. I'm using this code to get the data but for some reason i'm receiving this error:    We cannot convert the v...
  • jumercor's avatar
    2 years ago

    Thanks everyone, I solved it by myself. Here you can check the final solution:

     

    let
    data = "{""properties"":[""hs_survey_type""],""filterGroups"":[{""filters"":[{""propertyName"":""hs_createdate"",""operator"":""BETWEEN"",""highValue"":""1705552000000"",""value"":""1704064000000""},{""propertyName"":""hs_survey_type"",""operator"":""EQ"",""value"":""CSAT""}]}]}",
    baseuri = "https://api.hubapi.com/crm/v3/objects/feedback_submissions/search",
    initReq = Json.Document(Web.Contents(baseuri, [
    Headers = [
    Authorization="Bearer HERE_THE_TOKEN",
    #"Content-Type"="application/json"
    ],
    Content=Text.ToBinary(data)
    ])),
    initData = initReq[results]
    in
    initData

     

    First I moved 'Content' into web.contents parameters, and also I reformated 'data' from a text o a binary using Text.ToBinary