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 : http://speckle.xyz/graphql

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

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

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