Skip to content

Commit

Permalink
Added query params for quotes endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrea committed May 20, 2024
1 parent f271050 commit e4ef17d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs.waifu.it",
"version": "3.1.7",
"version": "3.1.8",
"description": "The new and improved documentation for Waifu.it",
"scripts": {
"dev": "next dev",
Expand Down
52 changes: 28 additions & 24 deletions pages/rest-api/Texts/Quote/search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Tab, Tabs } from "nextra-theme-docs";

# Search

This endpoint allows you to access and retrieve information about your favorite quotes. To access the `/quote` endpoint, you
This endpoint allows you to access and retrieve information about your favorite quotes. To access the `/quote` endpoint, you
will need to provide the proper authentication using the Authorization header.


## Endpoint Details

The `/quote` endpoint allows you to retrieve information about a specific quote.

- **URL**: `/quote`
Expand All @@ -20,7 +20,7 @@ To make requests to the `/quote` endpoint, you must include an `Authorization` h
### Example Authorization Header

```jsx
Authorization: YOUR_ACCESS_TOKEN
Authorization: YOUR_ACCESS_TOKEN;
```

Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you.
Expand All @@ -29,11 +29,21 @@ Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you.

The request to the `/quote` endpoint should be a JSON object with the following headers:

| Header | Type | Description | Required |
| --------------- | ------- | ---------------------------------------------------- | -------- |
| `Authorization` | string | The unique identifier of the user sending the request. | True |
| Header | Type | Description | Required |
| --------------- | ------ | ------------------------------------------------------ | -------- |
| `Authorization` | string | The unique identifier of the user sending the request. | True |

### Parameters

The request parameters for the `/quote?{parameter}={value}` endpoint.

| Parameter | Type | Description | Required |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------- | -------- |
| `character` | string | (Optional) The desired character name for the query. If not provided, a random quote will be generated. | False |
| `anime` | string | (Optional) The desired anime name for the query. If not provided, a random quote will be selected. | False |

### Example Request

Here's example of how to make a request to the `/quote` endpoint.

<Tabs items={["JavaScript", "Python"]}>
Expand All @@ -58,6 +68,7 @@ Here's example of how to make a request to the `/quote` endpoint.

console.log(data);
```

</Tab>
<Tab>
```python
Expand All @@ -74,14 +85,15 @@ Here's example of how to make a request to the `/quote` endpoint.

print(data)
```

</Tab>
</Tabs>

Remember to replace `YOUR_ACCESS_TOKEN` with your actual access token.

## Responses

The server will respond with an appropriate message based on the input provided. A successfully API request will respond
The server will respond with an appropriate message based on the input provided. A successfully API request will respond
with a JSON object containing the following information:

- `_id`: The unique identifier of the quote.
Expand All @@ -92,29 +104,21 @@ with a JSON object containing the following information:

<Tabs items={["200 OK", "404 Not Found", "500 Internal Server Error"]}>
<Tab>
**Content Type:** `application/json`
```json copy=false
"_id": 88,
"quote": "I don't know everything. I just know what I know.",
"from": "Nisemonogatari",
"author": "Tsubasa Hanekawa"
```
**Content Type:** `application/json` ```json copy=false "_id": 88, "quote":
"I don't know everything. I just know what I know.", "from":
"Nisemonogatari", "author": "Tsubasa Hanekawa" ```
</Tab>
<Tab>
**Content Type:** `application/json`
```json copy=false
"status": 404,
"message": {}
**Content Type:** `application/json` ```json copy=false "status": 404,
"message": {}
```
</Tab>
<Tab>
**Content Type:** `application/json`
```json copy=false
"status": 500,
"message": {}
**Content Type:** `application/json` ```json copy=false "status": 500,
"message": {}
```
</Tab>
</Tabs>

This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/)
for Python to interact with the `/quote` endpoint.
This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/)
for Python to interact with the `/quote` endpoint.

0 comments on commit e4ef17d

Please sign in to comment.