I'm attempting to connect to the Braintree API from deluge and I'm having some problems. I'm trying to use Braintree's graphql to do this.
I'm able to set up a basic query but I'm having trouble using variables.
- headerMap = Map();
- headerMap.put("Authorization","Basic //my authorization id");
- headerMap.put("Braintree-Version","2022-02-13");
- headerMap.put("Content-Type", "application/json");
- parameterMap = Map();
- parameterMap.put("query","query Search($input: CustomerSearchInput!) { search { customers(input: $input) { pageInfo { hasNextPage startCursor endCursor }, edges { node { id } } } } }");
- valueMap = Map();
- valueMap.put("is","0394827483");
- IdMap = Map();
- IdMap.put("id",valueMap);
- inputMap = Map();
- inputMap.put("input",IdMap);
- parameterMap.put("Variables",inputMap);
- test = invokeurl
- [
- url :"https://payments.braintree-api.com/graphql"
- type :POST
- parameters:parameterMap
- headers:headerMap
- ];
This produces a JSON object that looks like this.
- {
- "query": "query Search($input: CustomerSearchInput!) {
- search {
- customers(input: $input) {
- pageInfo {
- hasNextPage
- startCursor
- endCursor
- },
- edges {
- node {
- id
- }
- }
- }
- }
- }",
- "variables": {
- "input": {
- "id": {
- "is": "7492836219"
- }
- }
- }
- }
For some reason, I keep getting back an error that says
{"extensions":{"requestId":"422e0d97-ee7d-4cb5-806b-a619db924d30"},"data":null,"errors":[{"message":"Unable to process JSON","extensions":{"errorClass":"VALIDATION","errorType":"developer_error"}}]}
Does anyone know why?