# Increasing Play count via web api

**URL:** <https://forums.plex.tv/t/increasing-play-count-via-web-api/560781>\
**Category:** Dev/API Corner\
**Tags:** plex-web, other-dev\
**Created:** [March 24, 2020, 11:24am UTC](https://forums.plex.tv/t/increasing-play-count-via-web-api/560781 "2020-03-24T11:24:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoadster\_gmail.com](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/yoadster_gmail.com/32/104423_2.png) [@yoadster\_gmail.com](https://forums.plex.tv/u/yoadster_gmail.com)\
**Post date:** [March 24, 2020, 11:24am UTC](https://forums.plex.tv/t/increasing-play-count-via-web-api/560781/1 "2020-03-24T11:24:51Z")

</div>

Hi, im currently writing a little plex app with the aim to teaching me some angular and typescript. Everything is going well apart from one little issue:

via the web api im getting the play count of media items per user (pretty simple). The response contains the number of times the item has been played. I want to be able (via some sort of call) to increase that played number however its currently escaping me…

I can see via fiddler that a call is made to:

[https://analytics.plex.tv/collect/event](https://analytics.plex.tv/collect/event)… i’ve replayed this event in fiddler however the count doesnt increase.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![yoadster\_gmail.com](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/yoadster_gmail.com/32/104423_2.png) [@yoadster\_gmail.com](https://forums.plex.tv/u/yoadster_gmail.com)\
**Post date:** [March 25, 2020, 6:17pm UTC](https://forums.plex.tv/t/increasing-play-count-via-web-api/560781/2 "2020-03-25T18:17:46Z")

</div>

I’ve worked out how to do it and thought I would post my findings if ever anyone else has the same challenge.

All you need to do is call the following endpoint twice:

http://[server-ip]:[server-port]/:/timeline/?ratingKey=[rating-key]&key=[key]&state=[state]&hasMDE=1&time=[time]&duration=[duration]&X-Plex-Token=[token]

Where:

[server-ip] = your server ip  
[server-port] = your server port  
[rating-key] = the rating key of the media item you wish to increase the count of  
[key] = the key of the media item…  
[state] = first time call should be “playing” and the second call should be “stopped”  
[time] = first time call should be 0 and the second is the value of [duration]  
[duration] = the total duration of the media item  
[token] = your plex token

---

<div class="post-metadata">

**Author:** ![faruz](https://avatars.discourse-cdn.com/v4/letter/f/9dc877/32.png) [@faruz](https://forums.plex.tv/u/faruz)\
**Post date:** [May 6, 2020, 5:28am UTC](https://forums.plex.tv/t/increasing-play-count-via-web-api/560781/3 "2020-05-06T05:28:59Z")

</div>

Do you have a working script that does that? Something more use friendly?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [August 4, 2020, 5:29am UTC](https://forums.plex.tv/t/increasing-play-count-via-web-api/560781/4 "2020-08-04T05:29:00Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
