2019-11-21 21:31:05 +08:00
|
|
|
# mirai-api-http
|
|
|
|
|
2019-12-15 17:00:02 +08:00
|
|
|
<b>
|
|
|
|
Mirai-API-http provides adapter for ALL langugae to access mirai via HTTP protocol.<br>
|
|
|
|
</b>
|
2019-12-17 11:02:45 +08:00
|
|
|
|
|
|
|
**[中文](README_CH.md)**
|
2019-12-15 17:00:02 +08:00
|
|
|
|
|
|
|
|
2019-12-15 17:15:25 +08:00
|
|
|
### Start Session-Authorize
|
2019-12-15 17:00:02 +08:00
|
|
|
|
|
|
|
```php
|
|
|
|
Path: /auth
|
|
|
|
Method: POST
|
|
|
|
```
|
|
|
|
this verify your session to one bot and you could have full access to that bot<br>
|
|
|
|
NOTE that only 1 bot could be control under 1 session, you could have multiple session to control all bots.
|
|
|
|
|
2019-12-15 17:15:54 +08:00
|
|
|
#### Request:<br>
|
2019-12-15 17:11:06 +08:00
|
|
|
|
2019-12-15 17:00:02 +08:00
|
|
|
| name | type | optional|example|note|
|
|
|
|
| --- | --- | --- | --- | --- |
|
2019-12-15 17:11:06 +08:00
|
|
|
| key | String |false|U9HSaDXl39ksd918273hU|MIRAI API HTTP key, this could be found after initialize|
|
2019-12-15 17:01:41 +08:00
|
|
|
| qq | String |false|1040400290|bot QQ number you want to access|
|
2019-12-15 17:00:02 +08:00
|
|
|
|
|
|
|
|
2019-12-15 17:15:54 +08:00
|
|
|
#### Response if success:<br>
|
2019-12-15 17:11:06 +08:00
|
|
|
|
|
|
|
| name | type | example|note|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| success |Boolean |true|if this session is authorized|
|
|
|
|
| session |String |UANSHDKSLAOISN|your session key|
|
|
|
|
|
|
|
|
|
2019-12-15 17:15:54 +08:00
|
|
|
#### Response if failed:<br>
|
2019-12-15 17:14:03 +08:00
|
|
|
|
|
|
|
| name | type | example|note|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| success |Boolean |false|if this session is authorized|
|
|
|
|
| session |String |null|your session key|
|
|
|
|
| error |int |0|error code|
|
|
|
|
|
2019-12-15 17:15:54 +08:00
|
|
|
#### Error:<br>
|
2019-12-15 17:14:03 +08:00
|
|
|
|
|
|
|
| code | reason|
|
|
|
|
| --- | --- |
|
|
|
|
| 0 | wrong MIRAI API HTTP key |
|
|
|
|
| 1 | unknown bot number |
|
|
|
|
|
|
|
|
|
2019-12-15 17:11:06 +08:00
|
|
|
without session key, you are not able to access any method below.</br>
|
2019-12-15 17:15:25 +08:00
|
|
|
session key should be attached to your <b>cookies</b> like this:
|
2019-12-15 17:11:06 +08:00
|
|
|
|
|
|
|
| name | value |
|
|
|
|
| --- | --- |
|
|
|
|
| session |your session key here |
|
2019-12-15 17:00:02 +08:00
|
|
|
|
2019-12-15 17:11:06 +08:00
|
|
|
if you were getting HTTP error code 403, you should ask for a new session key.
|