Open AuHau opened 1 year ago
Good idea, the REST API could use some love. I'm ok with only supporting json for the POST bodies and the responses. Would require some changes when scripting the API with e.g. curl, but nothing that jq can't handle.
Great ideas and I agree that it needs a lot of love.
I would follow a similar pattern that the nimbus Eth2 api follows when it comes to the rest framework. An example can be found here - https://github.com/status-im/nimbus-eth2/blob/stable/beacon_chain/rpc/rest_beacon_api.nim.
Going through the API as part of documenting it for OpenAPI and have several suggestions on how to make it cleaner.
json
for most, if not all, responses to have them unified/connect
returns a simple string for all the responses/connect
could return404
when a peer is not foundPOST /sales
, for example, accepts a normal number instead of the required hex-decimal string for values and creates a Request with all values zeroed. Instead, it should properly error out with status 400 and a description of what is wrong.POST /storage/request/{cid}
passes CID parameter of the request as a path section. I would argue that it should be better to use a query parameter or move it directly into the JSON body. Moreover, there isGET /storage/purchases/{id}
, which has a similar format, but the ID is a Request ID instead of a CID, which is quite confusing.proofProbability
which should not be big int anyhow if I understand its usage correctly.