Content API

Content API

Here are examples of how our Content API may be called, from different programming languages. Don't have an access token yet? Get in touch!

Curl

curl -v -H'content-type:application/json' -H'authorization:INSERT_SECRET_HERE' -X'POST' --data '
{
"article": {
"url": "http://example.com/articles/42",
"title": "Article title",
"body": "Article text...",
"language": "en",
"published_at": "2022-01-01T12:24:56+01:00"
}
}' https://content.aeternalabs.ai/v1/content

Python

import requests
data = {
'article': {
'url': 'http://example.com/articles/42',
'title': 'Article title',
'body': 'Article text...',
'language': 'en',
'published_at': '2022-01-01T12:24:56+01:00'
}
}
response = requests.post('https://content.aeternalabs.ai/v1/content',
headers={'authorization': 'INSERT_SECRET_HERE'}, json=data)
print(response)

PHP

$data = array(
"article" => array(
"url" => "https://example.com/123",
"title" => "Article title",
"body" => "Article text...",
"language" => "en",
"published_at" => "2022-01-01T12:24:56+01:00"
) );
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, 'https://content.aeternalabs.ai/v1 content');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: INSERT_SECRET_HERE',
'Content-Type: application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$result = curl_exec($curl);
curl_close($curl);
print($result);