Forum Discussion

Richard_Halsall's avatar
1 year ago
Solved

JSON query text error Monday.com api

Hi

 

I require help with an error I am receiving when querying the Monday.com api, I have tried multiple versions but just can't seem to resolve

 

I have 2 versions of the query and both are returning the same error at the JSON step

 

Version 1

 

let
Key = MondayKey,
Board = id_board,
Group = id_group1,
Source = Web.Contents(MondayBaseURL,
[
RelativePath="v2",
Headers=[
#"Method"="POST",
#"Content-Type"="application/json",
#"Authorization"= Key,
#"API-Version" = "2023-10"
],
Content=Text.ToBinary("{""query"": ""{ boards (ids: " & Board & ") {groups (ids: " & Group & " ) {items_page (limit:500) { cursor items { id name column_values { column{title} text}}}}}}""}")
]
),

#"JSON" = Json.Document(Source,65001),

 

Version 2

let
Key = MondayKey,
Board = id_board,
Group = id_group1,
Source = Web.Contents(MondayBaseURL,
[
RelativePath="v2",
Headers=[
#"Method"="POST",
#"Content-Type"="application/json",
#"Authorization"= Key,
#"API-Version" = "2023-10"
],
Content = Json.FromValue([query= "query { boards (ids: " & Board & ") {groups (ids: " & Group & " ) { items_page (limit:500) { cursor items { id name column_values { column{title} text}}}}}"])
]
),

 

#"JSON" = Json.Document(Source,65001),

 

The error is specific to the groups parameters and states it is expecting a text value. The boards parameter is also a text value and this resolves fine

 

All the parameters I reference in the query are text values

 

Any help or guidance would be appreciated

 

Thanks

 

 

  • Hi thanks for taking the time to review and yes id_group1 is text

     

    Had a lightbulb moment and amended the parameter value in PQ to replicate what I have in Postman for id_group1 rather than trying to build through the code and it now works.

     

3 Replies

  • so you are absolutely sure that  id_group1 is a text?  Maybe use

     

    Group = Text.From(id_group1),

     

    Also, could be a freak coincendence that "Group"  is a reserved word?

    • Richard_Halsall's avatar
      Richard_Halsall
      Helper IV

      Hi thanks for taking the time to review and yes id_group1 is text

       

      Had a lightbulb moment and amended the parameter value in PQ to replicate what I have in Postman for id_group1 rather than trying to build through the code and it now works.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Richard_Halsall ,

         

        Thanks for reaching out to the Microsoft fabric community forum.

        I hope your issue has been resolved. If so, please mark the helpful reply and accept it as the solution. This will assist other community members with similar problems in resolving them more quickly.

         

        Thank you.