Name API

JonMosenkis edited this page Nov 15, 2017 · 4 revisions

Used as primarily as an "autocompleter", the name api takes a string and attempts to match that string against our data.

url: api/name/(?P<name>.+)

Some examples:

(Tip: install a JSON viewer for your browser so you can experiment with these on your own)

A name

  "lang": "en",
  "is_ref": false,
  "type": "Person",
  "key": "Rashi",
  "completions": Array[16][
    "Rashi on Zevachim",
    "Rashi on Zephaniah",
    "Rashi on Zechariah",
    "Rashi on Yoma",
    "Rashi on Yevamot",
    "Rashi on Temurah",
    "Rashi on Taanit",
    "Rashi on Sukkah",
    "Rashi on Sotah",
    "Rashi on Song of Songs",
    "Rashi on Shevuot",
    "Rashi on Shabbat",
    "Rashi on Sanhedrin",
    "Rashi on Ruth",
    "Rashi on Psalms"

As can be seen, Rashi is both a person and a commentator (and as such, Sefaria has many indices that start with his name). Rashi is not a valid Ref, but the suggested completions will lead to valid indices and Refs.

A Ref

  "completions": Array[1][
  "examples": Array[0][
  "type": "ref",
  "is_node": false,
  "is_range": false,
  "index": "Shabbat",
  "addressExamples": Array[2][
  "book": "Shabbat",
  "sectionNames": Array[2][
  "sections": Array[1][
  "is_book": false,
  "heAddressExamples": Array[2][
    "ב׳ א",
  "internalToSections": Array[1][
  "toSections": Array[1][
  "is_ref": true,
  "is_segment": false,
  "lang": "en",
  "heSectionNames": Array[2][
  "url": "Shabbat.2a",
  "ref": "Shabbat 2a",
  "internalSections": Array[1][
  "is_section": true

As can be seen, Shabbat 2a is a valid Sefaria Ref, and data about this reference is supplied. On the other hand, no suggestions for auto-completion are supplied.

A random string

It is possible to query any string against the name api. In this case, the name api will attempt to supply the best possible matches to the string.

  "lang": "en",
  "is_ref": false,
  "completions": Array[16][
    "Footnotes to Teshuvot haRashba part VII",
    "Footnotes to Teshuvot haRashba part VI",
    "Footnotes to Teshuvot haRashba part V",
    "Footnotes to Teshuvot haRashba part IV",
    "Footnotes to Kohelet by Bruce Heitler",
    "Footnotes on Teshuvot haRashba Meyuchas LehaRamban",
    "Footnotes on Orot",
    "Footnotes to Teshuvot haRashba part 7",
    "Footnotes to Teshuvot haRashba part 6",
    "Footnotes to Teshuvot haRashba part 5",
    "Footnotes to Teshuvot haRashba part 4",
    "Footnotes to Teshuvot haRashba helek Sheva",
    "Footnotes to Teshuvot haRashba helek Shesh",
    "Footnotes to Teshuvot haRashba helek Chamesh",
    "Footnotes to Teshuvot haRashba helek Arbah",
    "Footnotes on Orot, The Process of Ideals in Israel, Unification of Ideals"

  "lang": "en",
  "is_ref": false,
  "completions": Array[16][
    "Yoel ben Shmuel Sirkes",
    "Yonah ben Yisrael Babad",
    "Yosef Bekhor Shor",
    "Yosef Giqatillah",
    "Yosef Hayyim",
    "Yosef Shaul Nathanson",
    "Yom-Tov Lipmann Heller",
    "Yom Tov ben Avraham Isbilli",
    "Yoreh Deah",
    "Yoreh De'ah",
    "Yonah Gerondi",
    "Commentary on Sefer Hamitzvot of Rasag",
    "Commentary of Chida on Tractate Gerim"

The name api will attempt to reverse your keyboard from English to Hebrew (and vice versa) if no matches are found. For example, by typing the word בראשית with an English keyboard I will get crtah,.,

  "lang": "en",
  "is_ref": false,
  "completions": Array[16][
    "בראשית רבה",
    "שפת אמת, בראשית, בראשית",
    "פני דוד, בראשית, בראשית",
    "קדושת לוי, בראשית, בראשית",
    "שפת אמת, בראשית, פרשת בראשית",
    "נעם אלימלך, ספר בראשית, בראשית",
    "קדושת לוי, בראשית, פרשת בראשית",
    "נועם אלימלך, ספר בראשית, בראשית",
    "עבודת ישראל, ספר בראשית, בראשית",
    "מי השלוח, חלק א, ספר בראשית, בראשית",
    "מי השלוח, חלק ב, ספר בראשית, בראשית",
    "ספר הישר (מדרש), ספר בראשית, בראשית",
    "נעם אלימלך, ספר בראשית, פרשת בראשית",
    "ספר נועם אלימלך, ספר בראשית, בראשית",
    "נועם אלימלך, ספר בראשית, פרשת בראשית"
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.