Skip to content

Instantly share code, notes, and snippets.

@C0D4-101
Created March 2, 2022 09:42
Show Gist options
  • Save C0D4-101/d430026a70dda82c093260e14cbcbf3e to your computer and use it in GitHub Desktop.
Save C0D4-101/d430026a70dda82c093260e14cbcbf3e to your computer and use it in GitHub Desktop.
C# Post Rant
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://devrant.com/api/devrant/rants"),
Content = new FormUrlEncodedContent(new Dictionary<string, string>
{
{ "app", "3" },
{ "rant", "this is a test" },
{ "type", "3" },
{ "token_id", "auth.id" },
{ "token_key", "auth.key" },
{ "user_id", "auth.userid" },
{ "plat", "3" },
{ "tags", "rant" },
}),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment