๐C#
using System.Net.Http.Headers;
using System.Text;
var token = Environment.GetEnvironmentVariable("AUTOCONTENT_TOKEN") ?? "YOUR_API_TOKEN";
var endpoint = "https://api.autocontentapi.com/content/Create";
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, endpoint);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content = new StringContent("""
{
"outputType": "datatable",
"resources": [
{
"type": "text",
"content": "Company A raised $12M in Series A funding in Spain. Company B raised $35M in Series B funding in France."
}
],
"text": "Create columns for company, country, funding stage, funding amount, and positioning notes."
}
""", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new Exception($"Request failed: {(int)response.StatusCode} {response.ReasonPhrase}\n{body}");
}
Console.WriteLine(body);Last updated