Title: Using with REST
Last modified: May 3, 2017

---

# Using with REST

 *  Resolved [Arya](https://wordpress.org/support/users/aryaink/)
 * (@aryaink)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/using-with-rest/)
 * How do I get the post view counts using REST in php ?
    I am using [JSON API By Dan Phiffer](https://wordpress.org/plugins/json-api/#description)
   to get recent posts to an external webapp.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/using-with-rest/#post-9096083)
 * Hey,
 * You can do it like this using the WP builtin REST API and PVC custom endpoint:
   ../
   wp-json/post-views-counter/get-post-views/?id=133 where id is the post ID you
   want to get the views count for.
 * By default the required capability is ‘read_posts’ so only registered and logged
   in users are allowed to make that kind of API call. You can adjust that however
   using pvc_rest_api_get_post_views_check filter hook.
 * For example this added to your theme or plugin will allow anyone to access the
   views:
 * `add_filter( 'pvc_rest_api_get_post_views_check', '__return_true' );`
 *  Thread Starter [Arya](https://wordpress.org/support/users/aryaink/)
 * (@aryaink)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/using-with-rest/#post-9099286)
 * Super. Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using with REST’ is closed to new replies.

 * ![](https://ps.w.org/post-views-counter/assets/icon-256x256.png?rev=2973820)
 * [Post Views Counter](https://wordpress.org/plugins/post-views-counter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-views-counter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-views-counter/)
 * [Active Topics](https://wordpress.org/support/plugin/post-views-counter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-views-counter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-views-counter/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Arya](https://wordpress.org/support/users/aryaink/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/using-with-rest/#post-9099286)
 * Status: resolved