Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// References:
// API Calls:
// How to make HTTP requests in C# [StackOverflow]:
// NOTE: This code is very rough because I don't actually know C#, so it won't work right off the bat
using System.Net.Http;
class PiratesAPIClient {
private static readonly HttpClient client = new HttpClient();
Request Data:
* 'username': String, 3-20 characters
* 'password': String
Response Data:
* 'token': String
* 'session_ttl': Number/Date in UNIX time
void createUser() {
// Values that we will send to the server. AKA Request Data
// Replace foo and bar with values that the user inputted
var values = new Dictionary<string, string>
{ "username", "foo" },
{ "password", "bar" }
var content = new FormUrlEncodedContent(values);
// Make POST request
var response = await client.PostAsync("", content);
var responseString = await response.Content.ReadAsStringAsync();
// not sure what to do from here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment