Hi community! let’s see if you can solve my problems.
I’m trying to create a pulse with post http from java and i recieve that error message:
“No query string was present”
I’m sending a String :
String data = “‘mutation’ { ‘create_item’(board_id: xxx, group_id: ‘topics’, item_name: ‘Api created’) {id}}”;
And content type application/graphql
Any ideas on this? Unfortunately I’ve got the same problem trying to create a pulse in Monday.com
Using the Monday API tester (monday.com) it works. However, using scriptrunner in JIRA i can only get a successfull test using a “query” not a “mutation” request.
Same problem unfortunately. I’ve been through as much documentation as i can find. The API doc states the content-type should be application/json but i tried the other one anyway.
curl -X POST -H “Content-Type:application/x-www-form-urlencoded” -H “Authorization:xxxx” -d ‘{“mutation”:“{create_item (board_id: xxx,item_name: "my curl item") {id}}}”}’ “https://api.monday.com/v2/”
same error - No query string was present.
Again, the “query” command works fine. Maybe it’s a Monday.com setting that I don’t know about, white-listed sources perhaps. I’m going to check that.
thanks @rob, that’s definitely where i was going wrong. Cheers!
Although the curl still has an issue with the JSON format for some reason.
However, i’m using an online version as i can’t use the one from my machine as my company proxy is twitchy about https://reqbin.com/
Jumping in to clarify the behaviour that Rob mentioned:
First off, all operations to a GraphQL API are queries. Mutations are a subset that write or update data, but they are a kind of query.
All requests to our API should use the ‘query’ key to send the query string (which could read or mutate data). This is why option 4 doesn’t work – you need to pass the mutation as the “query” key.
If your query string doesn’t include the keyword “query” or “mutation” at the front then our query parser will assume it is a read operation.
This is why this works: {"query" : "{boards { id } }"}
But this does not: {"query" : "{create_item(...) {id}"}
Hope this helps clarify things. I’ll also see about adding this to the documentation somewhere.