API call of avarage

API call of avarage

Hi how can i obtain via api call the avarage of a field (Sales) of records from one specific day_?

i know i can get this info  in a snippet on a page but i want to know this value avarage of all via API

also i can get this value on a pivot table but pivot table report  doesn't work with api.