diff options
| author | Ritesh Ghosh <[email protected]> | 2024-03-25 18:57:26 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2024-03-25 18:57:26 +0530 |
| commit | 488a3593d20ce4591f120c0f17663b86242a2ecd (patch) | |
| tree | 69edbb75876218099223f032cfb55c040aa7aad4 | |
| parent | e136af03bf174c0ea46a5c3eec9f3599ad8cd2be (diff) | |
| download | aniwatch-api-488a3593d20ce4591f120c0f17663b86242a2ecd.tar.xz aniwatch-api-488a3593d20ce4591f120c0f17663b86242a2ecd.zip | |
docs(advancedSearch): add advanced search documentation
| -rw-r--r-- | README.md | 41 |
1 files changed, 36 insertions, 5 deletions
@@ -401,24 +401,50 @@ console.log(data); #### Endpoint ```sh +# basic example https://api-aniwatch.onrender.com/anime/search?q={query}&page={page} + +# advanced example +https://api-aniwatch.onrender.com/anime/search?q={query}&genres={genres}&type={type}&sort={sort}&season={season}&language={sub_or_dub}&status={status}&rated={rating}&start_date={yyyy-mm-dd}&end_date={yyyy-mm-dd}&score={score} ``` #### Query Parameters -| Parameter | Type | Description | Required? | Default | -| :-------: | :----: | :---------------------------------------------------------------: | :-------: | :-----: | -| `q` | string | The search query, i.e. the title of the item you are looking for. | Yes | -- | -| `page` | number | The page number of the result. | No | `1` | +| Parameter | Type | Description | Required? | Default | +| :----------: | :----: | :---------------------------------------------------------------: | :-------: | :-----: | +| `q` | string | The search query, i.e. the title of the item you are looking for. | Yes | -- | +| `page` | number | The page number of the result. | No | `1` | +| `type` | string | Type of the anime. eg: `movie` | No | -- | +| `status` | string | Status of the anime. eg: `finished-airing` | No | -- | +| `rated` | string | Rating of the anime. eg: `r+` or `pg-13` | No | -- | +| `score` | string | Score of the anime. eg: `good` or `very-good` | No | -- | +| `season` | string | Season of the aired anime. eg: `spring` | No | -- | +| `language` | string | Language category of the anime. eg: `sub` or `sub-&-dub` | No | -- | +| `start_date` | string | Start date of the anime(yyyy-mm-dd). eg: `2014-10-2` | No | -- | +| `end_date` | string | End date of the anime(yyyy-mm-dd). eg: `2010-12-4` | No | -- | +| `sort` | string | Order of sorting the anime result. eg: `recently-added` | No | -- | +| `genres` | string | Genre of the anime, separated by commas. eg: `isekai,shounen` | No | -- | + +> [!TIP] +> For both `start_date` and `end_date`, year must be mentioned. If you wanna omit date or month specify `0` instead. +> Eg: omitting date -> 2014-10-0, omitting month -> 2014-0-12, omitting both -> 2014-0-0 #### Request sample ```javascript +// basic example const resp = await fetch( "https://api-aniwatch.onrender.com/anime/search?q=titan&page=1" ); const data = await resp.json(); console.log(data); + +// advanced example +const resp = await fetch( + "https://api-aniwatch.onrender.com/anime/search?q=girls&genres=action,adventure&type=movie&sort=score&season=spring&language=dub&status=finished-airing&rated=pg-13&start_date=2014-0-0&score=good" +); +const data = await resp.json(); +console.log(data); ``` #### Response Schema @@ -456,7 +482,12 @@ console.log(data); ], currentPage: 1, totalPages: 1, - hasNextPage: false + hasNextPage: false, + searchQuery: string, + searchFilters: { + [filter_name]: [filter_value] + ... + } } ``` |
