dyczko
July 25, 2021, 3:54pm
1
Hi
I’m looking for api documentation.
In particular I would like to know how to read “current monthly earnings”.
I know about:
api/sno,
api/sno/satellites,
Is there anything else?
Thank you.
Alexey
July 25, 2021, 4:47pm
2
The only available documentation is posted here:
With v0.35.3 the storage node dashboard API endpoints have changed. If you don’t know how to open the dashboard API please take a look at the old thread here: Storage node dashboard API (v0.19.0)
The new endpoints are:
/api/sno
/api/sno/satellites
/api/sno/satellite/${id}
/api/notifications/list?page=1&limit=10
In the code I can also see the following endpoints but I was not able to test them:
/api/notifications/readall
/api/notifications/${id}/read
Payout data is available with v1.3.3
…
But you can checkout GitHub:
server := Server{
log: logger,
service: service,
listener: listener,
notifications: notifications,
payout: payout,
}
router := mux.NewRouter()
// handle api endpoints
storageNodeController := consoleapi.NewStorageNode(server.log, server.service)
storageNodeRouter := router.PathPrefix("/api/sno").Subrouter()
storageNodeRouter.StrictSlash(true)
storageNodeRouter.HandleFunc("/", storageNodeController.StorageNode).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/satellites", storageNodeController.Satellites).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/satellite/{id}", storageNodeController.Satellite).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/estimated-payout", storageNodeController.EstimatedPayout).Methods(http.MethodGet)
notificationController := consoleapi.NewNotifications(server.log, server.notifications)
notificationRouter := router.PathPrefix("/api/notifications").Subrouter()
So, the endpoint for estimation is http://localhost:14002/api/sno/estimated-payout
The example for PowerShell:
((curl http://localhost:14002/api/sno/estimated-payout).Content | ConvertFrom-Json).currentMonth
And for bash
curl -sL http://localhost:14002/api/sno/estimated-payout | jq '.currentMonth'
You need to divide the result for .payout
, .held
, .egressBandwidthPayout
, .egressRepairAuditPayout
, .diskSpacePayout
to 100.00
to see them in $
, not cents.
2 Likes
dyczko
July 25, 2021, 7:59pm
3
Thank you very much Alexey!
I really appreciate your support!
1 Like
Hey Alexey! I tried those payoutstubs links and I am getting weird numbers in response like those from one of the satellites:
"compPutRepair": 0,
"compGetAudit": 15,
"surgePercent": 0,
"held": 2006182,
"owed": 6018547,
"disposed": 0,
"paid": 6018547,
"distributed": 12528337
Tried to sum all satellites to check if anything adds up, and it seems that it works with one important notice…
(it adds up to like $15M for one of my node… I hope that I don’t have to pay tax on that hahaha
After careful checking out - those numbers need to be divided by 1’000’000 (1M) to arrive with correct $value - at least for payoutstubs
Alexey
August 30, 2021, 8:27am
5
As said in the Storage node dashboard API (v1.3.3)
"compGet":11329142, -> $ 11.32 (0.566 * $ 20)
"compPut":0,
"compGetRepair":1107763, -> $ 1.1 ($10 per TB)
"compPutRepair":0,
"compGetAudit":23, -> $0.000023 ($10 per TB)
"surgePercent":0,
"held":0, -> Held amount depending on the node age
"owed":90849277, -> Payout reduced by held amount
"disposed":77275128, -> Any held amount payback. In this example graceful exit. It will also show the 50% payback in month 15
"paid":90849277} -> Final payment for usage + held amount
you need to divide money-related numbers to 1,000,000.00
1 Like
dyczko
August 31, 2021, 8:47pm
6
Thank you.
Last question…(I hope) - I’m building a little to test my node.
How can I check the status via API? Is it?
“lastPinged”:“2021-08-31T21:44:50.8941457+01:00”,
in :14002/api/sno/
Does it mean that my node last time was available at 2021-08-31T21:44:50.8941457+01:00
Is this ping regular?
Thank you.
Alexey
August 31, 2021, 9:13pm
7
you unlikely get more definitive answer than there Status Online is it from api/sno
yes, this is time when the satellites saw your node last time. There is no specific schedule, your node should check-in on the satellites regularly.
storagenode setup --help | grep contact
API broken?
When I enter /api/notifications/list
I get
{"error":"consoleapi notifications: strconv.ParseUint: parsing \"\": invalid syntax"}
But I believe it should work:
storageNodeRouter := router.PathPrefix("/api/sno").Subrouter()
storageNodeRouter.StrictSlash(true)
storageNodeRouter.HandleFunc("/", storageNodeController.StorageNode).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/satellites", storageNodeController.Satellites).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/satellite/{id}", storageNodeController.Satellite).Methods(http.MethodGet)
storageNodeRouter.HandleFunc("/estimated-payout", storageNodeController.EstimatedPayout).Methods(http.MethodGet)
notificationController := consoleapi.NewNotifications(server.log, server.notifications)
notificationRouter := router.PathPrefix("/api/notifications").Subrouter()
notificationRouter.StrictSlash(true)
notificationRouter.HandleFunc("/list", notificationController.ListNotifications).Methods(http.MethodGet)
notificationRouter.HandleFunc("/{id}/read", notificationController.ReadNotification).Methods(http.MethodPost)
notificationRouter.HandleFunc("/readall", notificationController.ReadAllNotifications).Methods(http.MethodPost)
payoutController := consoleapi.NewPayout(server.log, server.payout)
payoutRouter := router.PathPrefix("/api/heldamount").Subrouter()
payoutRouter.StrictSlash(true)
payoutRouter.HandleFunc("/paystubs/{period}", payoutController.PayStubMonthly).Methods(http.MethodGet)
payoutRouter.HandleFunc("/paystubs/{start}/{end}", payoutController.PayStubPeriod).Methods(http.MethodGet)
payoutRouter.HandleFunc("/held-history", payoutController.HeldHistory).Methods(http.MethodGet)
payoutRouter.HandleFunc("/periods", payoutController.HeldAmountPeriods).Methods(http.MethodGet)
Alexey
March 14, 2024, 8:39am
9
Perhaps the list just empty.
Egon
March 14, 2024, 8:46am
11
Currently list
endpoint also expects limit
and page
query arguments as well. i.e. this should work (although, I didn’t test it)
/api/notifications/list?page=0&limit=100
Although, it would be probably better if it defaulted to some value or provide a better error message. Anyways created an issue for tracking it storagenode/console/consoleapi: list endpoint arguments page and limit should be optional · Issue #6865 · storj/storj · GitHub
3 Likes
Great. While 0 does not work:
{"error":"consoleapi notifications: notificationsdb: page can not be 0"}
But 1 does. So it is not broken and I can see the notifications now.
Egon
March 14, 2024, 8:51am
13
Hopefully, we can eventually migrate console api to apigen
generator, which should give us better documentation and also make it clearer what’s expected. In addition to a stable JS/TS client interfaces.
2 Likes