Roblox Open Cloud - C# - StatusCode 400 "Bad Request"

Hello,

today i started playing around with the Roblox Open Cloud using C#. Im really new to C# but that´s not the point. Every time I ran my code I got the exact same message.

Status:
WaitingForActivation

Result:
StatusCode: 400, ReasonPhrase: ‘Bad Request’

I tried changing the key, the topic and the way i send the data, but nothing changed.

I don´t know what i´m doing wrong. Can someone please explain to me what is causing this.

Code
HttpClient httpClient = new HttpClient();

var universeId = 3549767470; //3549767470
String topic = "dashboard-test";
String url = $"https://apis.roblox.com/messaging-service/v1/universes/{universeId}/topics/{topic}";
String Key = "nope";

httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.Add("x-api-key", Key);

var data = new {
    message = "Hello from C#"
};

var dataJson = JsonConvert.SerializeObject(data);
var payload = new StringContent(dataJson, Encoding.UTF8, "application/json");

var request = httpClient.PostAsync(new Uri(url), payload);
Console.WriteLine(new Uri(url));
Console.WriteLine(request.Status);
Console.WriteLine(request.Result);

Console.ReadKey();

Thanks

Please format your code in a code block so its easier for developers to read code and help you

```cs
// code goes here
```

Are you sure topic name is compliant with topic name restrictions of the API? In the documentation it states this:

1 Like