Hi, Community,

As an API Gateway project, I would like to propose a RESTful modification
of current APIs.

This mail is used to discuss the current status of ManagerAPI, here is an
example:

Request:
```sh
$ curl -X POST http://127.0.0.1:9090/apisix/admin/routes -d {DATA}
```

Response:
```json
{
  "code": 0,
  "request_id": "",
  "message": "",
  "data": {}
}
```

There have 4 problems:
1. The Request URL contains the "/apisix/admin" prefix, which preserves the
Admin API style. Should we omit this prefix and have Manager's RESTful APi?
2. Response Body contains code, message, request_id, data fields, and the
client will take more care of "data" field, while the other fields are
auxiliary and can be replaced with HTTP Status Code. As for the 400
parameter error status code, we could use a special errMessage field for
error description.
3. We don't maintain the `code` filed, we don't know what it should be in
different cases.
4. The data field will contain all request body's data in some APIs, I see
GitHub also using this way for API call-chain. (Not a problem IMO)

What to do next?
1. List all APIs;
2. Proposal which part we should change for every API;
3. Have the final agreement.

What's your opinion?

Reference
- GitHub: https://docs.github.com/en/rest/reference
- Stripe: https://stripe.com/docs/api
- MDN: https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status

Best Regards!
@ Zhiyuan Ju <https://github.com/juzhiyuan>

Reply via email to