blocknetdx / exrproxy-env

erp-ethserver
7 stars 10 forks source link

Add `get_project_stats` endpoint #177

Closed ConanMishler closed 2 years ago

ConanMishler commented 2 years ago

Converting this from a note to an issue bc I can't see how we can launch XQuery without this. Even if the Client Control Panel is ready, that Control Panel will likely need to use this method to retrieve the data it needs to display on the website.

ConanMishler commented 2 years ago

@shrnkld Do we have a list of values that will be returned by the get_project_stats method, and their definitions? I can't complete the Projects API section of the API docs until I have these details. Of course, the dev can't implement the task without these details either...

ConanMishler commented 2 years ago

So it looks like the get_project_stats method will be called like this:

curl http://<NODE-URL>/xrs/projects/<PROJECT-ID> \
      -X POST \
      -H "Content-Type: application/json" \
      -H "Api-Key: <API-KEY>" 
      -d '{"id": 1, "method": "get_project_stats", "params": []}'

And here is an initial list of parameters and their definitions which I think it should return:

{
  "error": 0,
  "result":
    {
      "api_key": "uiF_scQgopWWhgDFT7AMbM2Vf2b66xlfnVrJe6e1gUE",
      "status": "active",
      "tier":1, 
      "api_tokens":6000000,
      "api_tokens_used":0, 
      "api_tokens_remaining":6000000, 
      "expiry_time": "N/A", 
      "expires": "2022-11-19 22:17:53 EST", 
      "project_id": "85f1641d-f8ab-4acb-aa00-5d19601a9dd7"
    }
}
Parameter Type Description
error integer Error code
result object Object of the result.
api_key string API Key of the project, referred to in this document as <API-KEY>.
status string pending, active or inactive: pending = "not yet paid, but <PROJECT-ID> and <API-KEY> have been created." active = "paid and has API calls available." inactive = "project was active, then expired due to expiration time being reached, or no API calls remaining."
tier integer 0 if status is pending; 1 for tier1; 2 for tier2
api_tokens string Initial number of API calls granted to the project
api_tokens_used string Number of API calls used in the project
api_tokens_remaining string Number of API calls remaining in the project
expiry_time string If status is pending, this parameter will display the time by which payment is due to prevent the project from being cancelled. if status is active or inactive, this parameter will display, "N/A"
expiration string If status is pending, this parameter will display, "N/A." If status is active or inactive, this parameter will display the time when the project expires (or expired).
project_id string The project ID of the project, referred to in this document as <PROJECT-ID>
ConanMishler commented 2 years ago

Closed with https://github.com/blocknetdx/exrproxy/pull/42