Por que este json é valido:
{
"query":"mutation{ createCard(input: {pipe_id: 426174 fields_attributes: [{field_id: \"o_que\", field_value: \"Igor\"}{field_id: \"idade\", field_value: \"21\"}{field_id: \"cidade\", field_value: \"Vila Velha - ES\"}] parent_ids: [\"2735966\"] }) { card {id title }}}"
}
E este esta dando inválido nos testes que faço:
{"query":"mutation {
createTableRecord(input: {
table_id: \"RL-p4Ud_\"
title: \"Igor Oliveira\"
due_date: \"2018-04-10T11:04:57-03:00\"
fields_attributes: [{
field_id: \"nome_completo\",
field_value: \"Igor Oliveira\"
}, {
field_id: \"e_mail\",
field_value: \"[email protected]\"
}, {
field_id: \"telefone\",
field_value: \"279800002\"
}]
}) {
table_record {
id title
}
}"}
o erro é o seguinte:
Invalid characters found.[Code 18, Structure 4]
A ideia é o query ter todo o mutation como se fosse uma string mesmo.
No PHP estou criando assim:
$query = '{"query":"';
$query .= 'mutation {
createTableRecord(input: {
table_id: \"RL-p4Ud_\"
title: \"'.$nomecompleto.'\"
due_date: \"'.date('c').'\"
fields_attributes: [{
field_id: \"nome_completo\",
field_value: \"'.$nomecompleto.'\"
}, {
field_id: \"e_mail\",
field_value: \"'.$email.'\"
}, {
field_id: \"telefone\",
field_value: \"'.$telefone.'\"
}]
}) {
table_record {
id title
}
}';
$query .= '"}';