Really helpful tutorial!
Boutar Badii
1

The GET request itself shouldn’t include the orderby parameter; instead it should include only the ID of the post being viewed, like this: https://websiteurl.com/wp-json/base/views/POST_ID

Each time a post is viewed and this GET request is fired, it’ll update the “views” custom field value of that particular post to add one more to its view total.

With this in place, you can use a WP_Query to load the posts that have the most views by including these parameters in the query args:

‘meta_key’ => ‘views’ 
‘orderby’ => ‘meta_value_num’