Thomas Segato
Thomas Segato

Reputation: 5221

Compose GraphQL for monday.com

I am trying to build a framework around monday.com API. Following statement works:

var query = @"{""query"": ""mutation {create_item(board_id: 1111, group_id:\""new_group\"", item_name: \""adding works\"", column_values: \"" {\\\""long_text\\\"": { \\\""text\\\"": \\\""Sample text\\\""}} \"") {id}  }"" }";

All the escaping is not er super fluid way of working. Is there a better and more readable way?

But it is a nightmare to work with all this escaping. All input are welcome. Especially when I want to build the query dynamically.

Upvotes: 1

Views: 1009

Answers (1)

Vlad Mystetskyi
Vlad Mystetskyi

Reputation: 26

you can compose GraphQL query with variables. This is a good way how to make your queries dynamic and to overcome double escaping.

More information about it here: https://graphql.org/learn/queries/#using-variables-inside-fragments

There is a tutorial for composing monday GraphQL query with variables here: https://support.monday.com/hc/en-us/articles/360013465599-API-Quickstart-Tutorial-Javascript ("Creating a new item using GraphQL variables" section)

Upvotes: 0

Related Questions