Skip to content

Staging #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updated docs to support the latest v4 api update
  • Loading branch information
a3ryk committed Jan 10, 2024
commit 81d48fda818da23a41b2c2944f9c8f9eca16ed08
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.0.5",
"version": "3.0.6",
"description": "The new and improved documentation for Waifu.it",
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion pages/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<br />

### How do I get the API token?
- To get your API token, join this [discord server](https://discord.gg/yyW389c), then type `-claim` in [#bot-commands](https://discord.com/channels/479300008118714388/800784815908454452), fill the questions asked by `@Kohai` in DM, and receive your token.
- To get your API token, just login to [dashboard](https://waifu.it/dashboard)

{/* ### CORS causing trouble?

Expand Down
9 changes: 9 additions & 0 deletions pages/rest-api/Images/Waifu/search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ The request to the `/waifu` endpoint should be a JSON object with the following
| --------------- | ------- | ---------------------------------------------------- | -------- |
| `Authorization` | string | The unique identifier of the user sending the request. | True |

### Parameters

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

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

### Example Request
Here's example of how to make a request to the `/waifu` endpoint.

Expand Down
43 changes: 35 additions & 8 deletions pages/rest-api/start.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
import { Tab, Tabs } from "nextra-theme-docs";
import { Tab, Tabs,Callout } from "nextra-theme-docs";


# Get Started
## Base URL

```
https://waifu.it/api
```

## API Versioning

<Callout type="error" emoji="❌">
Some API and Gateway versions are now non-functioning, and are labeled as discontinued in the table below for posterity.
Trying to use these versions will fail and return 400 Bad Request.
</Callout>

Waifu.it exposes different versions of our API. You should specify which version to use by including it in the request path
like `https://waifu.it/api/v{version_number}`. Omitting the version number from the route will route requests to the current
default version (marked below). You can find the change log for the newest API version [here](https://github.com/WaifuAPI/api/releases).

**API Versions**

| Version | Status | Default |
|---------|--------------|---------|
| 4 | Available | ✓ |
| 3 | Deprecated | |
| 2 | Discontinued | |
| 1 | Discontinued | |

The base URL for the Waifu.it REST API is: [`https://waifu.it/api/:endpoint`](https://waifu.it/api)
- Replace `:endpoint` with the endpoint you want response from.

## Authentication

- Use the API token that you generate to authenticate each request made to the API.
Authenticating with the Waifu.it API can be done using a token found on the **Dashboard** page within your settings.
If you don't have an API token, then just head over to https://docs.waifu.it/faq, then read and get one for free.

For all authentication types, authentication is performed with the `Authorization` HTTP header in the format `Authorization: TOKEN`.

> If you don't have an API token, then just head over to https://docs.waifu.it/faq, then read and get one for free.
**Example Token Authorization Header**

**Request Header**
>
> - Set your API token as the `Authorization` header on every request.
```
Authorization: MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs
```


**Request Samples**
Expand Down