I'm attempting to test an API from FreeAgent CRM that implements GraphQL.
I'm struggling to format the request for the following example. https://api.freeagent.network/#list-app-fields
This is the example of the request:
query getFields($entity:String,$show_hidden:Boolean) {
getFields(entity:$entity,show_hidden:$show_hidden){
id
name
name_label
main_type
is_required
is_visible
is_unique
default_value
catalog_type_id
reference_field_id
reference_fa_entity_id
reference_fa_entity_name
}
}
I've converted this to json in order to send it with a cURL request from the command line.
curl -i -H "Authorization: bearer MY_TOKEN" -X POST -d '{"query": "query getFields($entity:"products",$show_hidden:false) { getFields(entity:$entity,show_hidden:$show_hidden){ id name name_label main_type is_required is_visible is_unique default_value catalog_type_id reference_field_id reference_fa_entity_id reference_fa_entity_name }}"}' https://freeagent.network/api/graphql
I've attempted to format this various ways, I'm not sure if I'm interpreting the graphql documentation wrong, or if there is something funny happening in this specific API and how it is setup.
Regardless of the format that I try to send, I get an error that no query string is supplied.
{"errors":[{"message":"Must provide query string."}]}
I've reached out to the support team, but wanted to cast a broader net so that I can learn more about graphql as I'm sure I'll get a better explanation as to what I'm doing wrong from the SO community.