I can't explain the qtree output difference, other than a possible scope difference (all vservers v.s. one vserver for example).
I found the explanation for the aggregate count difference... the ONTAP REST API doesn't include root aggregates.
Ref: https://library.netapp.com/ecmdocs/ECMLP2856304/html/index.html
Retrieving storage aggregate information
The Storage Aggregate GET API retrieves all data aggregates in the cluster. System owned root aggregates are not included in the output.
This API also supports specific queries, in addition to queries on aggregate body properties, which affect the output of the API. The parameters for these queries are “recommend” and "show_spares". Using the “recommend” query returns the list of aggregates that are recommended for creation in the cluster. The “show_spares” query returns a response outside of the records body, which includes the groups of usable spares in the cluster.