The TTL API is an excellent resource for advanced users who would like to engage programmatically with the website. TTL is currently quite limited when it comes to public endpoints, but is expanding by the minute. As of writing, you can make requests to the API to create posts. I hope to implement features such as:
- Editing posts
- Editing profile
- Requesting detailed post information
- Requesting detailed user information
- Requesting detailed post data
- Requesting specific posts according to various criteria
- And more!
Authentication
There are two things you will need for authenticating requests:
API Key
Session ID
Applying for an
API Key
is as simple as sending me a text message! A feature will soon be implemented where you can request an
API Key
from an API Dashboard page, but for now if you are interested, shoot me a text and I'll get you set up.
To get your
Session ID
you can follow these steps:
- Open
Web Developer Tools
on your browser
- Navigate to the
Network
tab
- Reload page
- Click on any request sent to website domain (externally stored images will not work)
- Click the
Cookies
tab
- Copy and paste the value following
connect.sid
. This is your Session ID
.
In the future, This information will too be available on the API Dashboard once that is developed.
You can now authenticate your requests once you have obtained both of these. Both the
API Key
and the
Session ID
will be passed through headers. Your
API Key
will need to be passed as the value to key
Authorization
. You can just copy and paste your provided
API Key
. The
Session ID
will need to be passed as value to key
Cookie
. You must here include
connect.sid=
in the value before pasting your
Session ID
.
All in all your request headers (for authenticating) should resemble this form:
headers {
Authorization: API Key,
Cookie: connect.sid=SESSION ID
}
NOTE:
DO NOT SHARE YOUR API KEY
OR SESSION ID
. Users who have access to these will be able to post from your account along with all other features offered. Take great care to not lose your
API Key
, as you will not be able to access it again without applying for a new one.
Endpoints
POST /api/automate/blog
The purpose of this endpoint is to allow users to create
simple posts. A
simple post is a post without images.
To craft your request you must include your credentials in the headers as well as
Content-Type: application/json
You can then pass your post through the
body
of the request in the following form:
body {
title: title,
body: body
}
Markdown rules will still work when crafting the body, you just won't have the luxury of the markdown editor when crafting them.
Don't abuse this or I will add daily request limits for everyone and beat you up 😇.
Example Requests
POST /api/automate/blog
JS:
const response = fetch('/api/automate/blog', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'API Key',
'Cookie': 'connect.sid=SESSION ID'
}
body: JSON.stringify({
title: 'title',
body: 'body'
}
});
Future Features
If you are looking for any specific feature comment below and I will prioritize that. I really created this just so I could automate creating weekly
Severance threads and practice writing API Documentation.