How does the search query work with Vimeo API for my videos (/me/videos)?
Asked Answered
H

2

17

Description

I'm trying to understand how the "search query" via Vimeo API works. I've even tried it out via their "playground" on Vimeo API for developers.

video shopping vimeo api Screenshot of the playground on Vimeo. As you can see the query takes in a "string" but there is not description on how it works.

I'm attempting to find a video via the a keyword that I put in the title. I've used the playground to test and see how the query actually works.

What I've tried

Filling out the "query" text box in the image above with NOTHING returns 2 results.

{
    "total": 2,
    /* Rest of data here */
}

This is expected because I've only uploaded two videos so far.

I've attempted to put a word from the title in the query but they always return 0 results.

Here is the PHP code I'm using, which of course returns 0 results.

public function findVimeoVideoByKeyword($keyword) {
    $response = $this->lib->request('/me/videos', [
        'query' => $keyword
    ]);

    # handle response code here...
}

This is the return data that I've dumped when searching for a specific word in a title (0 results):

VimeoService.php on line 168:
array:3 [▼
  "body" => array:5 [▼
    "total" => 0 //0 results
    "page" => 1
    "per_page" => 25
    "paging" => array:4 [▶]
    "data" => []
  ]
  "status" => 200
  "headers" => array:20 [▶]
]

This is the data returned when I do not search for anything (3 results):

VimeoService.php on line 167:
array:3 [▼
  "body" => array:5 [▼
    "total" => 3 //3 results
    "page" => 1
    "per_page" => 25
    "paging" => array:4 [▶]
    "data" => array:3 [▶]
  ]
  "status" => 200
  "headers" => array:21 [▶]
]

Searching for a video by querying with the FULL title returns 0 results.

Question

How do I correctly use the "query" property to search for specific videos according to their title with Vimeo API ?

Haply answered 12/7, 2016 at 15:4 Comment(0)
H
7

I went ahead and asked the same question on the VIMEO forums, and got a quick response from one of the devs.

When querying /me/videos only videos publicly available on vimeo.com are returned. Private videos are not indexed in search, and will not return when performing search queries.

I had originally thought that this was only for /videos and not for /me/videos

Apparently there is another approach for the search query to work on private videos.

Not yet implemented. We do have a workaround where if you enable Private Mode on your PRO account, you can then query videos on your account. Otherwise private videos are not available when performing search queries.

The key would be to put the PRO account in private mode which enables you to query videos on the account.

I have tested this. All that there is required to do is to set private mode by: Account Settings -> General -> Private Mode -> Enable It will then set your account to Private Mode and put all your videos as Private. The Search Query then works.

Haply answered 19/7, 2016 at 7:26 Comment(0)
J
0

Have a look at this example code they have in the repo of the lib. Looks like you need to urlencode the query value.

Jamboree answered 14/7, 2016 at 15:37 Comment(3)
I see you have 2 videos, what happens when you search with a keyword for one of them in the playground?Jamboree
Well that's the problem then. I just tested the code example linked above with my account and it just works as expected. Can you try to use the search (with your code) on another endpoint which is not /me, for example /videos? To me looks like this must be related to your account or to the videos you have: are they public? any specific configuration?Jamboree
Yes I understand you want to search your videos, my request was just a test to see the search working somewhere else. One last test: have you tried to search with different keywords or are you using always the same one (not knowing how/what they index...)? As I said I can't reproduce the issue on my account as query search works as expected. You better contact Vimeo support for this.Jamboree

© 2022 - 2024 — McMap. All rights reserved.