Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.
Options

Retrieve Folder Id by searching on Folder Name

Hello, I am trying to upload videos to Panopto using an application written in C#. I have created an API client and have successfully managed to upload a file to a particular folder using the folder id. My problem is that my application will not know the folder id but it will know the folder name. I am now trying to get the folder id using the rest v1 api method folders search. This brings back no results. Searching the community suggests that this is because I have the client api set up as a Server Application. The application I am writing will not have any user interface but will be automated overnight. How can I find out the folder id with just the folder name and without a user logging in.

Thanks,

David

Answers

  • Options
    Kevin BaumKevin Baum Panopto Employee

    Hi David,

    Thanks for your question. You are correct that the Server Application client will not work for folder search.

    You can use a User Based Server Application client instead to communicate with our REST API for a service that has no user interaction. The User Based Server Application allows sending credentials directly to the OAuth2 endpoints to get an access token, without the need for a user interface or a user to actively log in when retrieving the token. I would suggest creating a new user with the permissions that you need that can be used with your application to communicate with the Panopto REST API.

    You can find more information on creating and using a User Based Serve Application client in section 2.1 of the following support article:

    Please let me know if you run into any difficulties with creating or using the User Based Server Application client, or if you have any other questions.

    Thanks,

    Kevin

  • Options

    Hi Kevin,

    Thanks for for your help with this, I have tried posting to the endpoint as detailed in the support article but unfortunately I am getting an error...

    {

      "error": "invalid_grant",

      "error_description": "Invalid username or password"

    }

    I will detail the steps I took below so that hopefully you will be able to point out where I am going wrong. All usernames, passwords, servers etc. have been changed for security.

     1. Created a new system account APIaccount with password password1.

     2. Logged in to Panopto as new account.

     3. Created a new User Based Server Application api client called APIclient

     4. Noted api client Id and secret

     5. Encoded <api client id>:<api secret> to Base64.

     6. Noted application key under System -> Identity Providers.

     7. Combined lowercase username with pipe and application key = apiaccount|<key from step 6>

     8. Hashed the string created in step 7 with SHA256 and then encoded it with Base64.

     9. Created a new request in Postman.

    10. Added the header Authorization and entered value: Basic <string from step 5>.

    11. Amended request content type to x-www-form-urlencoded.

    12. Added Keys to Body of request:

    key: grant_type    value: password

    key: username     value: apiaccount

         key: password     value: string from step 9

         key: scope       value: api

    13. POST request to https://<myservername>/Panopto/oauth2/connect/token


    Hope you can spot the error.

    Thanks,

    David

  • Options

    @David MacLeman You're using SHA256, but that's only for External users. You said that you created an Internal user account. There may be a few other things here, so I filled in fake values in all-caps.

    Here's what's working for us at least:

    Headers:

    • Accept: application/json
    • Authorization: Basic <base64( CLIENT_ID:CLIENT_SECRET )>
    • Content-Type: application/x-www-form-urlencoded

    Body (notice the keys have capital letters, not sure if that matters):

    • Grant_type: password
    • Username: panoptointernal\USERNAME
    • Password: PASSWORD
    • Scope: api

    I hope that helps!

Sign In or Register to comment.