Storage node dashboard API (v1.3.3)

Where is the wiki? It would be nice to have that info collected in one place. A few examples how to use it (understandable for a non-programmer) would be nice. It’s very cumbersome to find it here in the forum with the api changing every now and then.

The first post in this thread

This is not a wiki, it is an out-of-date forum post about v0.19.

Or do you mean the post itself? Sorry, that’s not what I meant with “understandable by a non-programmer”. Is this all documentation there is?

It is not, as far as I know. For honestly I don’t think that non-programmer or non tech-savvy should use the API.

I mean this post:

It’s a first post in this thread.

2 Likes

I would appreciate some help to improve it. Please make it understandable. If you have any questions I will try my best to answer them. I am good in explaining everything but I don’t know how a “non-programmer” would like to get it presented.

3 Likes

I would like to point out that API stands for Application Programming Interface.

If some of the information is only available through the API, while non-programmers want access to it, the right question shouldn’t be to make the API simpler, but to include that information on the dashboard.

I never said I’m “non tech-savvy”, but I never really learnt a real :tm: programming language (only BASIC and Turbopascal back in the days :wink: ), but I’m quite ok with bash scripts.

For instance, how do I get a particular value inside of an array? For instance curl -s 127.0.0.1:14002/api/sno/|jq gives me all the info from that endpoint and curl -s 127.0.0.1:14002/api/sno/|jq .satellites gives me only the array “satellites”. But what if I only want some values of the arrays like the urls or even the url of one particular satellite? curl -s 127.0.0.1:14002/api/sno/|jq .satellites.url doesn’t work.
I can do this with grep and cut in bash, but is there a way with the api only?

Or another example, if I want the egress of a particular day on a particular satellite.

Also, your post sounds like there might be more endpoints and that list is not complete.

Edit: Ok, man jq took me a bit further with “filters”. So the satellite’s urls I can get with

curl -s 127.0.0.1:14002/api/sno/|jq .satellites|jq '.[]|.url'

Could this be done with one jq command instead of piping it twice through it?

I am haoy with this dashboard, VB.net pareced all i needed so far.

If you’re wanting examples of how to parse the data, you should check out the Prometheus Storj exporter (https://github.com/anclrii/Storj-Exporter), it is quite comprehensive on what it pulls from the API.

2 Likes

yes. Just put all filters in the quotes

 curl -s 127.0.0.1:14002/api/sno/ | jq '.satellites | .[] | .url'

By the way, the language of jq is Turing-completed, so you can write anything to process json in any needed way

1 Like

That looks realy nice!

2 Likes

Is there a simple way to get the “Undistributed payout” from API?
image

Have you tried from the first post?

Basically you should find the first period when the .distributed is zero, then sum this and all following .paid until now.