Search code examples
vimeovimeo-api

Check views on Vimeo via API


I need to hide video embedding or deactivate the video once it reaches 200 views. Is it possible to check the count of views of a video on Vimeo via API? I can't find this information on the API reference...

I'm trying with this call:

http://vimeo.com/api/v2/video/283030956.json

that video is hidden on vimeo but embedded in a website. When I call the url it returns 283030956 not found.

Is it a problem with the video's privacy?


Solution

  • It looks like the video at https://vimeo.com/283030956 either doesn't exist, or is private. The old Simple API you're using (with the path /api/v2/video/[video_id].json) can only access videos public on Vimeo.

    (The Simple API is also deprecated.)

    The video's total play count is returned when getting the video's metadata via the full-fledged core API:

    curl --location --request GET 'https://api.vimeo.com/videos/[video_id]' \
    --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer [auth_token]' \
    

    Documentation is found here:

    https://developer.vimeo.com/api/reference/videos#get_video https://developer.vimeo.com/api/reference/responses/video