using curl to get interface kbits/s reading from APIv2?

I’m trying to get an average in/out value from last ten readings from a particular host sgn, using APIv2:

http://my.netdata.local.server:19999/api/v2/data?scope_nodes=sgn&contexts=system.net&after=-10

The problem I have is that what I receive is evidently incorrect, as in value resembles out value and is drastically different than I see on the netdata visualisation in the same time.

Is my query correct? If yes, in which json elements should I expect to have an aggregated data?

Hi @RandomNet,

You need to specify you want to average the result with aggregation option.

http://my.netdata.local.server:19999/api/v2/data?scope_nodes=sgn&contexts=system.net&after=-10&aggregation=avg

I suggest you to use browser developer tools to check how Cloud is performing the request.

As I can see in the docs, the aggregation option has a default value, which is appropriate for my needs and I do not need to to modify it. The developer tools show you don’t use aggregation but aggregate the results probably in the javascript - so it does not answer my question.

As you can see, developer tools do show the use of aggregation option.

http://localhost/api/v3/data?points=315&format=json2&time_group=average&time_resampling=0&after=1735126974&before=1735127874&options=jsonwrap|nonzero|flip|ms|jw-anomaly-rates|minify&contexts=*&scope_contexts=system.load&scope_nodes=a87285b8-c2b6-11ef-a94f-0242ac120002&nodes=*&instances=*&dimensions=load1&labels=*&group_by[0]=dimension&group_by_label[0]=&aggregation[0]=avg

Please follow the same approach.