‎27-11-2023 04:21 PM
Hello,
I have a problem with sending POST requests to GraphQL API from Java Application. For example, I want to get a list of applications filtered by name and I send a request with the next body:
String query = "{\"query\":\"{application(filter:{name_contains: \"test\"}){id name comment}}\"}";
But all I get when trying to read the response is
Object reference not set to an instance of an object.
When I'm using the GET method (to get data from my dataset), response is as expected, a JSON with a proper data.
Please, help me with this topic, maybe someone could provide a sample code sending POST request and reading the response?
Solved! Go to Solution.
‎27-11-2023 04:28 PM - edited ‎27-11-2023 04:29 PM
Well, that's the second time I've asked a question here and then I managed to find the answer within few minutes by myself!
The correct query looks like this:
String query = "{\"query\":\"query{ application(filter:{name_contains: \\\"test\\\"}){ id name comment }}\",\"variables\":{}}";
Gotta use the postman when creating next Java queries!