Error 400 when fetching Comments with POST request from UE5 C++

Although I can use this

query { comments(streamId:“2171b53ac6”){ items{ authorId }}

successfully in graphql playground :

, when I make a POST request in C++ it gives me error 400 bad request with this response.

<html lang="en">
<meta charset="utf-8">
<pre>Bad Request</pre>

I have the feeling that the http REST API is closed for fetching comments.

1 Like

Are you including your authorisation in the headers of the request?

Yes I am including the Bearer. I have noticed that the error messages in REST API are not the same as in GraphQL playground. Error 400 could mean anything. Replacing the graphql command with other commands such user or stream, it works well. The “comments” query is the only that is not working. Perhaps it is still in work in progress that is not implemented in the API ?

I have found it finally after many many many trials. It is this:

FString sid = "2171b53ac6"; 
const FString PostPayload = "{\"query\": \"query{comments(streamId:\\\"" + sid + "\\\"){items{authorId}}}\"}";

It shouldn’t be so difficult. The error responses are not helpful. I had to make a wild guess that took me 3 hours to find alternative string formats.

1 Like