Error on parse query when Text or bad request

Hi Community,
I’m trying to create a new pulse, the query works fine but, if the item_name have a long text with spacebar it give me a 400 response or parse

I’m working with Java.

Request working:
String query = “{“query”:“mutation{create_item(board_id: 88486632, group_id: topics, item_name: apiTest){id}}”}”

Request doesn’t work:
Try double quote text with scaped quotes
String query = “{“query”:“mutation{create_item(board_id: 88486632, group_id: topics, item_name: “api Test”){id}}”}”
Error: 400 Bad Request

Try with simple quote without scape it:
String query = “{“query”:“mutation{create_item(board_id: 88486632, group_id: topics, item_name: ‘api Test’){id}}”}”
Error : {“errors”:[{“message”:“Parse error on “’” (error) at [1, 71]”,“locations”:[{“line”:1,“column”:71}]}],“account_id”:XXXXXXX}

Try with simple quote scaping it:
String query = “{“query”:“mutation{create_item(board_id: 88486632, group_id: topics, item_name: ‘api Test’){id}}”}”
Error: {“errors”:[{“message”:“Parse error on “’” (error) at [1, 71]”,“locations”:[{“line”:1,“column”:71}]}],“account_id”:XXXXXXX}

I tryed some more examples but all with same responses 400 or parse error.

If anyone can help me with how i have to send the text on mutation.
Thank you Community

Solution:
String query =
“{“query”:“mutation{create_item(board_id: 88486632, group_id: topics, item_name: \ \ \ " api espacios Prueba \ \ \ "){id}}”}”
-Espaced escapes to you can see it.

** You have to send the escape characters escapeds : ** Escape slash \ and escape quotes ".

Hope this help someone.
Thank you!

2 Likes

Thanks for posting your problem AND solution Borja!

1 Like