Using folder search API issue.
Hi All,
I'm new to use Panopto REST API.
I created a API client in our Panopto test environment, and request access token for service is successfully. When I try using the access token to call Folders search API, no matter what the keyword I'm using, the results is empty, I use the same keyword in GUI search I can get some results. Did I something wrong? Hope someone can help, give some suggestions, or give me a sample searchQuery.
Thanks in advance.
Regards,
Chen Rui
Best Answers
-
Kevin Baum Panopto Employee
Hi Rui,
Thanks for sending that to me. I believe that the issue is that you're using access tokens that come from a Server Application client. Access tokens created for use with a Server Application client cannot be used to search for folders since that requires user authorization, which is why you're always getting an empty list. Server Application clients are currently only used in a very limited manner.
In order to get results for most of the REST API endpoints, you would need to get an access token for a user (https://support.panopto.com/s/article/How-to-Get-OAuth2-Access-Tokens-for-Users) instead. This should get you the results from the Folder search API.
Please let me know if you have any other questions.
Thanks,
Kevin
5 -
Kevin Baum Panopto Employee
Hi Rui,
If the user is not logged into Panopto, they will need to log in first to get the authorization code, which you can exchange for the token. If the user has already logged in, then there shouldn't be any user interaction necessary. We don't currently require any additional confirmation to get an access token. It is also possible to store a refresh token after the user has logged in once, allowing you to get access tokens in the future without the user logging in. Those tokens can last up to 30 days, and can reduce the amount of user interaction necessary.
I hope this helps! Please let me know if you have any other questions.
Thanks,
Kevin
5 -
Kevin Baum Panopto Employee
Hello,
There are a few common reasons this error can come up:
- Please check that the client ID added to the Authorization request is correct.
- It's also possible to get this error if any parameters are missing from the request. Depending on the client type, please make sure all of the parameters are in the request, and that the parameter names are correct.
- Please check the redirect_url in the request exactly matches a redirect_url that has been added to the API Client in the Panopto API Clients interface. The redirect_url must match exactly in order to be considered valid.
If everything above is correct, and you're still having difficulty with retrieving an access token, please have your POC for Panopto open a support ticket with us so we can get some more detailed information and look into this further.
Please let me know if you have any other questions.
Thanks,
Kevin
5
Answers
Hi Rui,
I just tested this against one of my test sites, and was able to get results. I used a call similar to this:
https://<panoptoserver>/Panopto/api/v1/folders/search?searchQuery=test
Would you be able to send me an example of the call you are making (without any tokens or authorization information)? If so I would be happy to take a look at it.
Thanks,
Kevin
Hi Kevin
Thanks for your help. I don't what I did wrong, I try searchQuery=test, get empty result also.
Here is the API call I used https://suss-test.ap.panopto.com/Panopto/api/v1/folders/search?searchQuery=ACC201
ACC201 is a course code, should be part of the Panopto folder name. is that OK?
The results I get: {"Results":[]}
This is the document I learn how to get access token for services. https://support.panopto.com/s/article/oauth2-for-services
Best Regards,
Chen Rui
Hi Kevin
Thanks for your explanation. I'll try out the access Token for user.
What I'm creating an application to search video results from different source, include our Panopto, so before I get any search results, I hope there is no user "interfere". My understanding OAuth2 needs user to "confirm" before, then server give a "code", with this code, I can get access Token. how can I get ride of this "Confirm" in Panopto?
I appreciate your helps.
Best Regards,
Chen Rui
Hi Kevin
noted, thanks,
Regards,
Chen Rui
Hi Kevin
I tried to generate access token for user.
The step 1.3a, When I send user to Authentication URL, I got this error (see below). any idea what's wrong? thanks,
Best Regards,
Chen Rui
Hi Kevin
thanks for your help, problem solved.
is it good if the error message is more specific?
Regards,
Chen Rui
Hello, Chen Rui, Can you please share the solution, as I am also facing this error.