|
| 1 | +import { Tab, Tabs } from "nextra-theme-docs"; |
| 2 | + |
| 3 | +# Search |
| 4 | + |
| 5 | +This endpoint allows you to access and retrieve information about your favorite husbandos. To access the `/husbando` endpoint, you |
| 6 | +will need to provide the proper authentication using the Authorization header. |
| 7 | + |
| 8 | +## Endpoint Details |
| 9 | + |
| 10 | +The `/husbando` endpoint allows you to retrieve information about a specific husbando. |
| 11 | + |
| 12 | +- **URL**: `/husbando` |
| 13 | +- **Method**: GET |
| 14 | +- **Content Type**: application/json |
| 15 | + |
| 16 | +## Authentication |
| 17 | + |
| 18 | +To make requests to the `/husbando` endpoint, you must include an `Authorization` header in your API calls. This header should contain a valid access token. |
| 19 | + |
| 20 | +### Example Authorization Header |
| 21 | + |
| 22 | +```jsx |
| 23 | +Authorization: YOUR_ACCESS_TOKEN; |
| 24 | +``` |
| 25 | + |
| 26 | +Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you. |
| 27 | + |
| 28 | +## Request Headers |
| 29 | + |
| 30 | +The request to the `/husbando` endpoint should be a JSON object with the following headers: |
| 31 | + |
| 32 | +| Header | Type | Description | Required | |
| 33 | +| --------------- | ------ | ------------------------------------------------------ | -------- | |
| 34 | +| `Authorization` | string | The unique identifier of the user sending the request. | True | |
| 35 | + |
| 36 | +### Parameters |
| 37 | + |
| 38 | +The request parameters for the `/husbando?{parameter}={value}` endpoint. |
| 39 | + |
| 40 | +| Parameter | Type | Description | Required | |
| 41 | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------- | -------- | |
| 42 | +| `name` | string | (Optional) The desired character name for the query. If not provided, a random husbando will be generated. | False | |
| 43 | +| `anime` | string | (Optional) The desired anime name for the query. If not provided, a random husbando will be selected. | False | |
| 44 | + |
| 45 | +### Example Request |
| 46 | + |
| 47 | +Here's example of how to make a request to the `/husbando` endpoint. |
| 48 | + |
| 49 | +<Tabs items={["JavaScript", "Python"]}> |
| 50 | + <Tab> |
| 51 | + ```js |
| 52 | + import axios from "axios"; |
| 53 | + |
| 54 | + /* |
| 55 | + Replace "YOUR_ACCESS_TOKEN" with the token you got from the Kohai Bot and the endpoint. |
| 56 | + */ |
| 57 | + const url = "https://husbando.it/api/v4/husbando"; |
| 58 | + const data = async () => { |
| 59 | + try { |
| 60 | + const { data } = await axios.get(url, { headers: { |
| 61 | + Authorization: "YOUR_ACCESS_TOKEN", |
| 62 | + } }); |
| 63 | + return data; |
| 64 | + } catch (err) { |
| 65 | + throw new Error(err.message); |
| 66 | + } |
| 67 | + }; |
| 68 | + |
| 69 | + console.log(data); |
| 70 | + ``` |
| 71 | + |
| 72 | + </Tab> |
| 73 | + <Tab> |
| 74 | + ```python |
| 75 | + import requests |
| 76 | + |
| 77 | + """ |
| 78 | + Replace "YOUR_ACCESS_TOKEN" with the token you got from the Kohai Bot and the endpoint. |
| 79 | + """ |
| 80 | + url = "https://husbando.it/api/v4/husbando" |
| 81 | + response = requests.get(url, headers={ |
| 82 | + "Authorization": "YOUR_ACCESS_TOKEN", |
| 83 | + }) |
| 84 | + data = response.json() |
| 85 | + |
| 86 | + print(data) |
| 87 | + ``` |
| 88 | + |
| 89 | + </Tab> |
| 90 | +</Tabs> |
| 91 | + |
| 92 | +Remember to replace `YOUR_ACCESS_TOKEN` with your actual access token. |
| 93 | + |
| 94 | +## Responses |
| 95 | + |
| 96 | +The server will respond with an appropriate message based on the input provided. A successfully API request will respond |
| 97 | +with a JSON object containing the following information: |
| 98 | + |
| 99 | +- `_id`: The unique identifier of the husbando. |
| 100 | +- `name`: Information about the husbando's name. |
| 101 | + - `first`: The first name of the husbando. |
| 102 | + - `middle`: The middle name of the husbando (if available). |
| 103 | + - `last`: The last name of the husbando (if available). |
| 104 | + - `full`: The full name of the husbando. |
| 105 | + - `native`: The native name of the husbando. |
| 106 | + - `userPreferred`: The user's preferred name for the husbando. |
| 107 | + - `alternative`: An array of alternative names for the husbando. |
| 108 | + - `alternativeSpoiler`: An array of alternative names with potential spoilers. |
| 109 | +- `image`: Information about the husbando's image. |
| 110 | + - `large`: URL to a large image of the husbando. |
| 111 | +- `favourites`: The number of users who have favorited the husbando. |
| 112 | +- `siteUrl`: URL to the husbando's page on AniList. |
| 113 | +- `description`: Description of the husbando (if available). |
| 114 | +- `age`: Age of the husbando (if available). |
| 115 | +- `gender`: Gender of the husbando. |
| 116 | +- `bloodType`: Blood type of the husbando (if available). |
| 117 | +- `dateOfBirth`: Date of birth of the husbando (if available). |
| 118 | + - `year`: Year of birth. |
| 119 | + - `month`: Month of birth. |
| 120 | + - `day`: Day of birth. |
| 121 | +- `media`: Information about the media associated with the husbando. |
| 122 | + - `nodes`: An array of media nodes. |
| 123 | + - `id`: The unique identifier of the media. |
| 124 | + - `idMal`: The MyAnimeList identifier of the media. |
| 125 | + - `coverImage`: Information about the cover image of the media. |
| 126 | + - `medium`: URL to a medium-sized cover image of the media. |
| 127 | + - `bannerImage`: URL to a banner image of the media (if available). |
| 128 | + - `title`: Information about the title of the media. |
| 129 | + - `romaji`: Romaji representation of the title. |
| 130 | + - `english`: English representation of the title (if available). |
| 131 | + - `native`: Native representation of the title. |
| 132 | + - `userPreferred`: User-preferred representation of the title. |
| 133 | + - `synonyms`: An array of synonyms for the media title. |
| 134 | + - `popularity`: Popularity score of the media. |
| 135 | + - `type`: Type of the media (e.g., ANIME, MANGA). |
| 136 | + - `format`: Format of the media (e.g., TV, MANGA). |
| 137 | + |
| 138 | +<Tabs items={["200 OK", "404 Not Found", "500 Internal Server Error"]}> |
| 139 | + <Tab> |
| 140 | + **Content Type:** `application/json` |
| 141 | + ```json copy=false |
| 142 | + "status": 200, |
| 143 | + "_id": 14881, |
| 144 | + "name": { |
| 145 | + "first": "Ura no Ojiichan", |
| 146 | + "middle": null, |
| 147 | + "last": null, |
| 148 | + "full": "Ura no Ojiichan", |
| 149 | + "native": "裏のおじいちゃん", |
| 150 | + "userPreferred": "Ura no Ojiichan", |
| 151 | + "alternative": [], |
| 152 | + "alternativeSpoiler": [] |
| 153 | + }, |
| 154 | + "image": { |
| 155 | + "large": "https://s4.anilist.co/file/anilistcdn/character/large/default.jpg" |
| 156 | + }, |
| 157 | + "favourites": 0, |
| 158 | + "siteUrl": "https://anilist.co/character/257439", |
| 159 | + "description": null, |
| 160 | + "age": null, |
| 161 | + "gender": "Male", |
| 162 | + "bloodType": null, |
| 163 | + "dateOfBirth": { |
| 164 | + "year": null, |
| 165 | + "month": null, |
| 166 | + "day": null |
| 167 | + }, |
| 168 | + "media": { |
| 169 | + "nodes": [ |
| 170 | + { |
| 171 | + "id": 2406, |
| 172 | + "idMal": 2406, |
| 173 | + "coverImage": { |
| 174 | + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2406-nP8NIct9Sci3.jpg" |
| 175 | + }, |
| 176 | + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/anime/banner/2406-ROqXxejQ5bH9.jpg", |
| 177 | + "title": { |
| 178 | + "romaji": "Sazae-san", |
| 179 | + "english": null, |
| 180 | + "native": "サザエさん", |
| 181 | + "userPreferred": "Sazae-san" |
| 182 | + }, |
| 183 | + "synonyms": [ |
| 184 | + "Mrs. Sazae" |
| 185 | + ], |
| 186 | + "popularity": 1311, |
| 187 | + "type": "ANIME", |
| 188 | + "format": "TV" |
| 189 | + }, |
| 190 | + { |
| 191 | + "id": 43192, |
| 192 | + "idMal": 13192, |
| 193 | + "coverImage": { |
| 194 | + "medium": "https://s4.anilist.co/file/anilistcdn/media/manga/cover/small/b43192-lBoylrcHjwWA.jpg" |
| 195 | + }, |
| 196 | + "bannerImage": null, |
| 197 | + "title": { |
| 198 | + "romaji": "Sazae-San", |
| 199 | + "english": "The Wonderful World of Sazae-San", |
| 200 | + "native": "サザエさん", |
| 201 | + "userPreferred": "Sazae-San" |
| 202 | + }, |
| 203 | + "synonyms": [ |
| 204 | + "Heisei no Sazae-san", |
| 205 | + "The Wonderful World of Sazae-san" |
| 206 | + ], |
| 207 | + "popularity": 195, |
| 208 | + "type": "MANGA", |
| 209 | + "format": "MANGA" |
| 210 | + } |
| 211 | + ] |
| 212 | + } |
| 213 | + ``` |
| 214 | + </Tab> |
| 215 | + <Tab> |
| 216 | + **Content Type:** `application/json` |
| 217 | + ```json copy=false |
| 218 | + "status": 404, |
| 219 | + "message": {} |
| 220 | + ``` |
| 221 | + </Tab> |
| 222 | + <Tab> |
| 223 | + **Content Type:** `application/json` |
| 224 | + ```json copy=false |
| 225 | + "status": 500, |
| 226 | + "message": {} |
| 227 | + ``` |
| 228 | + </Tab> |
| 229 | +</Tabs> |
| 230 | + |
| 231 | +This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/) |
| 232 | +for Python to interact with the `/husbando` endpoint. |
| 233 | +That's it! You are now ready to use the `/husbando` endpoint to retrieve information about your favorite husbandos. Happy coding! |
0 commit comments