Version at: 20/11/2022, 20:46 vs. version at: 20/11/2022, 20:47
11# API
22
33This page gives a few examples of how to use the Tatoeba API.
44
55## For one sentence
66
77To retrieve sentence number 1:
88
99 https://tatoeba.org/eng/api_v0/sentence/1
1010
1111## Search results
1212
1313### Search: English sentences containing the word "Canadian" that have direct Japanese translations
1414
1515_Note that in English, unless the search string is preceded by an equals sign, the search will not be exact, so this query will also match "Canadians". For for more information, see "Main search field" in [How to Search for Text](text-search#)._
1616
1717 - from: **eng**
1818 - to: **jpn**
1919 - translations: **direct only**
2020
21 https://tatoeba.org/eng/api_v0/search?from=eng&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn
21`https://tatoeba.org/eng/api_v0/search?from=eng&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn`
2222
2323### Search: English sentences containing the word "Boston" that have audio and Japanese translations (direct or indirect), sorted by creation date
2424
2525 - from: **eng**
2626 - to: **jpn**
2727 - audio: **yes**
2828 - sort: **by creation date**
2929 - translations: **direct and indirect**
3030
3131 https://tatoeba.org/eng/api_v0/search?from=eng&trans_filter=limit&query=Boston&sort=created&has_audio=yes&trans_to=jpn&to=jpn
3232
3333### Search: English sentences containing the word "=play" (exact match) in list 907 that have direct translations in Japanese
3434
3535 - from: **eng**
3636 - to: **jpn**
3737 - list: **907**
3838 - sort: **words**
3939 - translations: **direct only**
4040
4141 https://tatoeba.org/eng/api_v0/search?from=eng&list=907&query=%3Dplay&sort=created&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn
4242
4343
4444### Other
4545
4646To figure out how to make a call to the API, you can perform an advanced search, then change the first part of the URL from this:
4747
4848 https://tatoeba.org/en/sentences
4949
5050to this:
5151
5252 https://tatoeba.org/eng/api_v0
5353
5454For instance, if you use the advanced search interface to select English sentences without audio that contain the word "those", you will see that the URL looks like this:
5555
5656 https://tatoeba.org/en/sentences/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=
5757
5858Change the first part of the URL in order to produce this URL, which uses the API:
5959
6060 https://tatoeba.org/eng/api_v0/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=
6161
6262## Paging
6363
6464You can use the count and perPage in the paging information to find out how many pages are contained in the search results. For instance, the following call:
6565
6666 https://dev.tatoeba.org/eng/api_v0/search?from=eng&list=907&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn&page=2
6767
6868will produce the following result:
6969
7070 "paging": {
7171 "Sentences": {
7272 "finder": "all",
7373 "page": 2,
7474 "current": 8,
7575 "count": 18,
7676 "perPage": 10,
7777 "start": 11,
7878 "end": 18,
7979 "prevPage": true,
8080 "nextPage": false,
8181 "pageCount": 2,
8282 "sort": null,
8383 "direction": null,
8484 "limit": null,
8585 "sortDefault": false,
8686 "directionDefault": false,
8787 "scope": null,
8888 "completeSort": []
8989 }
9090 },
9191
9292
9393
9494The relevant properties are:
9595
9696 - `page`: current page
9797 - `current`: number of items displayed in the current page
9898 - `count`: total number of results
9999 - `perPage`: number of results per page
100100
101101To find the number of pages in total, divide `count` by `perPage` and round up to the nearest integer.
102102
103103
104104
105105
106106## For more information on the API
107107
108108See Tatoeba/tatoeba2 GitHub issue [#2669][1].
109109
110110 [1]: https://github.com/Tatoeba/tatoeba2/issues/2669
111111
diff view generated by jsdifflib

Version at: 20/11/2022, 20:46

# API

This page gives a few examples of how to use the Tatoeba API.

## For one sentence

To retrieve sentence number 1:

    https://tatoeba.org/eng/api_v0/sentence/1

## Search results

### Search: English sentences containing the word "Canadian" that have direct Japanese translations

_Note that in English, unless the search string is preceded by an equals sign, the search will not be exact, so this query will also match "Canadians". For for more information, see "Main search field" in [How to Search for Text](text-search#)._

 - from: **eng**
 - to: **jpn**
 - translations: **direct only**

    https://tatoeba.org/eng/api_v0/search?from=eng&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn

### Search: English sentences containing the word "Boston" that have audio and Japanese translations (direct or indirect), sorted by creation date

 - from: **eng**
 - to: **jpn**
 - audio: **yes**
 - sort: **by creation date**
 - translations: **direct and indirect**

    https://tatoeba.org/eng/api_v0/search?from=eng&trans_filter=limit&query=Boston&sort=created&has_audio=yes&trans_to=jpn&to=jpn

### Search: English sentences containing the word "=play" (exact match) in list 907 that have direct translations in Japanese

 - from: **eng**
 - to: **jpn**
 - list: **907**
 - sort: **words**
 - translations: **direct only**

    https://tatoeba.org/eng/api_v0/search?from=eng&list=907&query=%3Dplay&sort=created&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn


### Other

To figure out how to make a call to the API, you can perform an advanced search, then change the first part of the URL from this:

    https://tatoeba.org/en/sentences

to this:

    https://tatoeba.org/eng/api_v0

For instance, if you use the advanced search interface to select English sentences without audio that contain the word "those", you will see that the URL looks like this:

    https://tatoeba.org/en/sentences/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=

Change the first part of the URL in order to produce this URL, which uses the API:

    https://tatoeba.org/eng/api_v0/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=

## Paging

You can use the count and perPage in the paging information to find out how many pages are contained in the search results. For instance, the following call:

    https://dev.tatoeba.org/eng/api_v0/search?from=eng&list=907&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn&page=2

will produce the following result:

    "paging": {
      "Sentences": {
        "finder": "all",
        "page": 2,
        "current": 8,
        "count": 18,
        "perPage": 10,
        "start": 11,
        "end": 18,
        "prevPage": true,
        "nextPage": false,
        "pageCount": 2,
        "sort": null,
        "direction": null,
        "limit": null,
        "sortDefault": false,
        "directionDefault": false,
        "scope": null,
        "completeSort": []
    }
  },



The relevant properties are:

 - `page`: current page
 - `current`: number of items displayed in the current page
 - `count`: total number of results
 - `perPage`: number of results per page

To find the number of pages in total, divide `count` by `perPage` and round up to the nearest integer.




## For more information on the API

See Tatoeba/tatoeba2 GitHub issue [#2669][1].

  [1]: https://github.com/Tatoeba/tatoeba2/issues/2669

version at: 20/11/2022, 20:47

# API

This page gives a few examples of how to use the Tatoeba API.

## For one sentence

To retrieve sentence number 1:

    https://tatoeba.org/eng/api_v0/sentence/1

## Search results

### Search: English sentences containing the word "Canadian" that have direct Japanese translations

_Note that in English, unless the search string is preceded by an equals sign, the search will not be exact, so this query will also match "Canadians". For for more information, see "Main search field" in [How to Search for Text](text-search#)._

 - from: **eng**
 - to: **jpn**
 - translations: **direct only**

`https://tatoeba.org/eng/api_v0/search?from=eng&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn`

### Search: English sentences containing the word "Boston" that have audio and Japanese translations (direct or indirect), sorted by creation date

 - from: **eng**
 - to: **jpn**
 - audio: **yes**
 - sort: **by creation date**
 - translations: **direct and indirect**

    https://tatoeba.org/eng/api_v0/search?from=eng&trans_filter=limit&query=Boston&sort=created&has_audio=yes&trans_to=jpn&to=jpn

### Search: English sentences containing the word "=play" (exact match) in list 907 that have direct translations in Japanese

 - from: **eng**
 - to: **jpn**
 - list: **907**
 - sort: **words**
 - translations: **direct only**

    https://tatoeba.org/eng/api_v0/search?from=eng&list=907&query=%3Dplay&sort=created&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn


### Other

To figure out how to make a call to the API, you can perform an advanced search, then change the first part of the URL from this:

    https://tatoeba.org/en/sentences

to this:

    https://tatoeba.org/eng/api_v0

For instance, if you use the advanced search interface to select English sentences without audio that contain the word "those", you will see that the URL looks like this:

    https://tatoeba.org/en/sentences/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=

Change the first part of the URL in order to produce this URL, which uses the API:

    https://tatoeba.org/eng/api_v0/search?from=eng&has_audio=no&native=&orphans=no&query=those&sort=relevance&sort_reverse=&tags=&to=&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=&trans_to=&trans_unapproved=&trans_user=&unapproved=no&user=

## Paging

You can use the count and perPage in the paging information to find out how many pages are contained in the search results. For instance, the following call:

    https://dev.tatoeba.org/eng/api_v0/search?from=eng&list=907&query=Canadian&trans_filter=limit&trans_link=direct&trans_to=jpn&to=jpn&page=2

will produce the following result:

    "paging": {
      "Sentences": {
        "finder": "all",
        "page": 2,
        "current": 8,
        "count": 18,
        "perPage": 10,
        "start": 11,
        "end": 18,
        "prevPage": true,
        "nextPage": false,
        "pageCount": 2,
        "sort": null,
        "direction": null,
        "limit": null,
        "sortDefault": false,
        "directionDefault": false,
        "scope": null,
        "completeSort": []
    }
  },



The relevant properties are:

 - `page`: current page
 - `current`: number of items displayed in the current page
 - `count`: total number of results
 - `perPage`: number of results per page

To find the number of pages in total, divide `count` by `perPage` and round up to the nearest integer.




## For more information on the API

See Tatoeba/tatoeba2 GitHub issue [#2669][1].

  [1]: https://github.com/Tatoeba/tatoeba2/issues/2669

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.