Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jumercor
Regular Visitor

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 value "[Binary]" to type Text

 

Details:
Value=[Binary]
Type=[Type]

 

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= Json.FromValue(data)]])),

initData = initReq[results]

in
initData

 

What might i am doing wrong?

1 ACCEPTED SOLUTION
jumercor
Regular Visitor

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

View solution in original post

4 REPLIES 4
jumercor
Regular Visitor

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

Sahir_Maharaj
Super User
Super User

Hello @jumercor,

 

Can you please try this:

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",
    
    content = Json.FromValue(Text.FromBinary(data)),
    headers = [
        Authorization="Bearer HERE_THE_TOKEN",
        #"Content-Type"="application/json"
    ],
    response = Web.Contents(baseuri, [
        Content=content,
        Headers=headers,
        Method="POST"
    ]),
    
    responseText = Text.FromBinary(response),
    
    initReq = Json.Document(responseText),
    initData = initReq[results]
in
    initData

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thanks, but I'm receiving -> Expression.Error: "Method" is not a valid option for Web.Contents. Valid options:

ApiKeyName, Content, ExcludedFromCacheKey, Headers, IsRetry, ManualStatusHandling, Query, RelativePath, Timeout

 

You don't need to specify Method. It is sufficient to provide a content payload, that will switch We.Contents from GET to POST automatically.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.