Your API requires the use of multiple levels of nested escaped JSON.
For example, when using create_item
to set column values.
Individual column values may contain newlines and quotes, which need to be escaped.
The column_values
argument needs to be converted to JSON, so its quotes and newlines need to be escaped, plus the ones in any individual column values need to be escaped a second time.
Then the mutation GraphQL document itself also need to be assigned to the query property of a JSON object qhich requires escaping the entire mutation document again.
There are multiple ways this nested escaping could be done. After much trial and error I have found that one format that works for create_item is this
{"query":"mutation {\r\n create_item (\r\n board_id: 6172423554, \r\n item_name: \"TEst9\", \r\n column_values: \"{\\\"note\\\":\\\"Newline\\\nStuff\\\\\\\"Quoted\\\\\\\"Stuff\\\"}\"\r\n ) \r\n {\r\n id\r\n }\r\n }\r\n"}
This form of nested escaping is not produced by the standard C# JSON libraries. They instead use \u0022
to escape quotes. Your API does returns an error if quotes are escaped using \u0022
so your API deserialization appears to be implementation specific.
Your example code is not very useful since it does not show what you actually need to construct, only the unescaped GraphQL.
The example provided here is painful enough, requiring quotes to be escaped with 7 backslashes at the most nested level, and this is just a trivial example. For more complex queries the payloads required are totally incompreshensible.
Does your API support payloads in a more reasonable format?
Is there any docmentation anywhere on what payload formats are supported regarding the multiple levels of nesting and escaping that are required?