SuttaCentral API access

Greetings to the suttacentral devs ! I’m currently developing a participative dictionary tool see (International Participative Pali Dictionary (IPPD) : looking for comments and advice) and here (https://pali.tny.ovh) for a very early proof of concept .

I’m working on the hyperlink system, and I would like to use suttacentral as the source of the texts : are the URL like https://suttacentral.net/mn11 stable, or is there better way to link to a specific text ? Also is there a specific link or API to know if a translation is available in a specific language, or to have the Pali name of this text ?

I’m currently using this file sc-data/text_extra_info.json at master · suttacentral/sc-data · GitHub ; I would prefer to use an API to avoid keeping in sync when the file changes. I didn’t find documentation about existing APIs, I would be grateful if some points me to the docs if they exist !

5 Likes

Voice is using this. We’d perhaps have to tag in @karl_lew to ask where he got it from.

2 Likes

The answer to this question depends on your definition of “source” and “stable”.

  • The JSON source of SuttaCentral Dhamma texts is https://github.com/suttacentral/bilara-data. The default branch of this repository is published. The segmented texts here are updated periodically, and available through the github API as, for example, https://raw.githubusercontent.com/suttacentral/bilara-data/published/translation/en/sujato/sutta/mn/mn11_translation-en-sujato.json. Non-segmented legacy texts are NOT included in bilara-data
  • The formatted HTML Dhamma content is indeed available from suttacentral itself with the URL like https://suttacentral.net/mn11. Such URLs are stable and good for end-user links.

Suttacentral has a suttaplex API that describes a sutta. Voice uses that API, which changes from time to time. It’s fairly stable, at least with respect to major semantic components.

https://suttacentral.net/api/suttaplex/mn11?language=en

Voice has had to solve the problem you’re facing and developed its own APIs for accessing SC data. The Voice APIs support search and audio. Those APIs are beta quality and somewhat unstable.

6 Likes

Great ! This is exactly what I was looking for :slight_smile:
I was looking for stable end-user links, and the suttaplex API answers all my questions, thank you.

2 Likes