Files
itstudio_manager/API.md
T
server_main 066fbf8a22 doc: API.md
2026-07-06 05:12:59 +00:00

139 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# http://localhost:8080/api
所有返回的json对象总有如下格式
```typescript
class respose<T> {
"code": number;
"message": string;
"data": T
}
```
接下来将省略`/api`并只给出`T`的类声明
当`"code"`不是`200`时,`"data"`必定为`null`
部分`/api/test`的返回值不遵循上述格式
## /test
### GET /hello
Authorization: Bearer $Token
key: 无
回复:
```typescript
"Hello Kotlin WebFlux!"
```
## /v1/auth
### POST /login
Authorization: 无
key: username, password
data:
```typescript
class data {
"username": string;
"role": string;
"token": string;
"expire": Date;
}
```
### GET /logout
Authorization: Bearer $Token
key: 无
data:
```typescript
null
```
### GET /ask-code?email=******&type=register
Authorization: 无
key: 无
data:
```typescript
null
```
### GET /ask-code?email=******&type=reset
Authorization: 无
key: 无
data:
```typescript
null
```
### POST /register
Authorization: 无
key: 无
data:email, code, username, password
```typescript
null
```
### POST /reset
Authorization: 无
key: email, code, password
data:
```typescript
null
```
### GET /relogin
Authorization: Bearer $Token
key: 无
data:
```typescript
class data {
"token": sting;
"expire": time
}
```
# ws://localhost:8080/ws
几乎所有的ws请求都需要先在`http`请求中获取`ticket`
## /test
回复:
```typescript
`Kotlin springboot4 received: ${userText}`
```