Telescope beyond: Open API (beta)

Next weeks and months I’m going to focus on important features that will allow Telescope to move a little bit beyond where it is now. These features will include different APIs, integrations, and even deprecations of some functionality that existed in Telescope since ages and haven’t really changed since then.

And let’s start with something very simple yet important: the API.

I’m not yet ready to present the whole set of methods for managing your blog from the API (and not sure it's that needed) and I am also not ready to show some nice and well-polished API docs but I am ready to introduce what I call an Open API — two first methods that allow to get/query the contents of your blog or get a specific article. Both methods return JSON objects.

GET https://telescope.ac/openapi/<blog_path> 
GET https://telescope.ac/openapi/<blog_path>/<article_path>

Customizing the query

GET https://telescope.ac/openapi/<blog_path> method can be customized. Just try playing with it by specifying one of the following additional parameters:

GET https://telescope.ac/openapi/<blog_path>?per_page=<per_page>&page=<page>&search=<search_query>

// per_page - (int; 20 by default) specifies how many results per page to return
// page - (int; 1 by default)
// query - (text; "" by default) any text that needs to be found in an article

The result will also contain a pagination object that can help you organize the correct pagination:

{
...
"pagination": {
"per_page": 20,
"per_page_default": 20,
"page": 1,
"total": 5,
"search_query": ""
}

Need an example?

My personal website currently contains all the articles it fetches from my Telescope blog. You can even view individual articles without visiting Telescope itself — they are displayed natively on my personal page with some matching styling.

Image

Here are the Open API methods it uses:

GET https://telescope.ac/openapi/alwxdev?
GET https://telescope.ac/openapi/alwxdev/<individual_article_path>

Have fun exploring!

~ Alex from Telescope.