Thanks for the reply @Helen.
This project got pushed to back burner last week, apologies for not responding sooner.
The code cannot run with single quotes due to the way strings are escaped in Power Query. Text.ToBinary() is being used because content requires binary input.
Neither of these should be causing an error because they are both present in the code I provided that works.
My understanding is that GraphQL is simply a HTTP Post request. I am able to query Monday’s API and get the needed data. I ran into an issue when trying to change data.
The below returns the intended data:
Web.Contents(
“https://api.monday.com/v2”,
[
Headers=[
Method=“POST”,
#“Content-Type”=“application/json”,
#“Authorization”=“Bearer " & Key
],
Content=Text.ToBinary(”{"“query”": ““query { boards(ids: 929960697) {activity_logs(limit: 1000) {event, entity, data, created_at, user_id, id}, name, id} }””}" )
]
)
The graphQL bit is:
{“query”: “query { boards(ids: 929960697) {activity_logs(limit: 1000) {event, entity, data, created_at, user_id, id}, name, id} }”}
The below is calling the API for a mutation.
Web.Contents(
“https://api.monday.com/v2”,
[
Headers=[
Method=“POST”,
#“Content-Type”=“application/json”,
#“Authorization”=“Bearer " & Key
],
//GraphQL Query
Content=Text.ToBinary(”{"“query”": "“mutation { change_simple_column_value(board_id: 929960697, item_id: 1006655013, column_id: “& ColumnID &”, value: “& value &”) {id, name}} “”}” )
]
)
The GraphQL is:
{“query”: "mutation { change_simple_column_value(board_id: 929960697, item_id: 1006655013, column_id: “text3”, value: “new value”) {id, name}} "}
What I am struggling to understand is why an identical piece of code other than the graphql query returns a 400 error code, when the first returns the intended data. Is there something wrong how my mutation query is structured? I have tested it in the API playground and it changed the value as intended.