You need to sign in to do that
Don't have an account?
Siri Deva Singh Khalsa
monday.com api (Apex, JSON, graphQL)
Hi Folks,
I'm tyring to connect to the monday.com api, which, as far as I understand, accepts graphQL queries in JSON format (https://monday.com/developers/v2).
When I run the code below, I get a 400 'no query string was present' error.
If I run the method
I can't even authenticate.
Any ideas?
I'm tyring to connect to the monday.com api, which, as far as I understand, accepts graphQL queries in JSON format (https://monday.com/developers/v2).
When I run the code below, I get a 400 'no query string was present' error.
If I run the method
req.SetHeader('Content-Type', 'application/json')
I can't even authenticate.
Any ideas?
public class mondayAPI{ public static httpResponse callout(){ String apiKey = 'mySuperSecretApiKey'; String query = '{ "query" { "boards"(ids: 813785147)}} '; //instantiate httpRequest HttpRequest req = new HttpRequest(); //set http method and endoint for request instance req.setMethod('POST'); req.setEndpoint('https://api.monday.com/v2'); //set body and header req.setHeader('Authorization', apiKey); req.setBody(query); //instantiate the http http h = new http(); //make the call out using the http.send() method HttpResponse res = h.send(req); Integer statusCode = res.getStatusCode(); String status = res.getStatus(); String body = res.getBody(); System.debug('Request Body: ' + req.getBody()); System.debug(statusCode); System.debug(status); System.debug(body); return res; } }
The graphQL within my JSON request body was malformed.
correct is:
The content-type request header needs to be set to json:
All Answers
I recommend trying the request in postman to confirm if the endpoint is correct
I also suggest posting this in the Monday community
https://community.monday.com/t/error-no-query-string-present/2704
https://community.monday.com/t/no-query-string-present-for-python-based-queries/1278/2
Let me know if this helps, if it does, please close the query by marking it as solved. It may help others in the community. Thank You!
The graphQL within my JSON request body was malformed.
correct is:
The content-type request header needs to be set to json: