HTTP 400 Bad request

Hello. I am passing this table through PostAsync (link works, tested with a basic text request.)

{
				{
					username = "Jackpot Win",
					embeds = {
						{
							description = a.Name .. ' has won the Server Jackpot. [Minimum: 0. Maximum: 1Qd]',
							fields = {
								color = 16777215,
								{
									name = "Chance",
									value = addtitle(chance)
								},
								{
									name = "Total",
									value = addtitle(jackpot.Total)
								},
								{
									name = "Added",
									value = addtitle(jackpot.Players[winner].Total);
								}
							}
						}
					}
				}
			}

and am getting HTTP 400 Bad request. Ideas?

1 Like

Convert it to JSON and validate your embeds on any discord embed generator.
Also, do you convert your data to JSON when sending POST request?

Yes.

game:GetService('HttpService'):PostAsync(link, game:GetService("HttpService"):JSONEncode(data));

Try to check your JSON validity in any embed generator for discord

Hmm, it just defaults it back to {
“embeds”: [],
“components”: []
} in the generator.

Should I form the embed in the generator, decode it, then paste that?

Yes, it’ll generate embed correct.

1 Like

Alright. I thought roblox sent data differently so thought that wouldn’t work. Thanks :smile:

1 Like