aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2024-03-25 18:57:26 +0530
committerRitesh Ghosh <[email protected]>2024-03-25 18:57:26 +0530
commit488a3593d20ce4591f120c0f17663b86242a2ecd (patch)
tree69edbb75876218099223f032cfb55c040aa7aad4
parente136af03bf174c0ea46a5c3eec9f3599ad8cd2be (diff)
downloadaniwatch-api-488a3593d20ce4591f120c0f17663b86242a2ecd.tar.xz
aniwatch-api-488a3593d20ce4591f120c0f17663b86242a2ecd.zip
docs(advancedSearch): add advanced search documentation
-rw-r--r--README.md41
1 files changed, 36 insertions, 5 deletions
diff --git a/README.md b/README.md
index 4ea343b..d80b96f 100644
--- a/README.md
+++ b/README.md
@@ -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]
+ ...
+ }
}
```