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.

Getting "Invalid UserId 00000000-0000-0000-0000-000000000000" when trying to get user's home folder

Sam EssSam Ess Tyro
edited December 20 in API

Hello, I'm trying to use the SOAP API to get a user's home folder to programmatically uploading files to their folder. Please find attached the code and error message:

def get_user_id(email, transport):
    client = zeep.Client(
        f"{base_url}/Panopto/PublicAPI/4.6/UserManagement.svc?wsdl",
        transport=transport,
    )
    user_key = f"SSO\\{email}"
    response = client.service.GetUserByKey(
        auth=None,
        userKey=user_key,
    )
    return response['UserId']

def get_user_home_folder(transport, userid) -> str: client: zeep.Client = zeep.Client( f"{base_url}/Panopto/PublicAPI/4.6/SessionManagement.svc?wsdl", transport=transport, ) folder_request = {"auth": None, "userID": userid, "allowCreation": False} folder_id = client.service.GetPersonalFolderForUser(folder_request)#←Crashes here return folder_id
╭─────────────────────── Traceback (most recent call last) ────────────────────────╮
│ /usr/scratch/sess/local/systems-lib/systemslib2/scripts/temp_trash_scripts/zoome │
│ r.py:449 in main                                                                 │
│                                                                                  │
│   446 │   user_id = get_user_id(user, transport)                                 │
│   447 │   #print(user_id)                                                        │
│   448 │   get_auth_cookie(panopto_token, session)                                │
│ ❱ 449 │   get_user_home_folder(transport, user_id)                               │
│   450 │                                                                          │
│   451 │   # recording = get_recordings_by_meeting(meeting_id, zoom_token)        │
│   452 │   # if not recordings["total_records"]:                                  │
│                                                                                  │
│                                                                                  │
│ /usr/scratch/sess/local/systems-lib/systemslib2/scripts/temp_trash_scripts/zoome │
│ r.py:409 in get_user_home_folder                                                 │
│                                                                                  │
│   406 │   )                                                                      │
│   407 │                                                                          │
│   408 │   folder_request = {"auth": None, "userID": userid, "allowCreation": Fal │
│ ❱ 409 │   folder_id = client.service.GetPersonalFolderForUser(folder_request)    │
│   410 │   return folder_id                                                       │
│   411                                                                            │
│   412                                                                            │
│                                                                                  │
│                                                                                  │
│ /usr/scratch/sess/local/systems-lib/build/dev-venv3.11/lib/python3.11/site-packa │
│ ges/zeep/proxy.py:46 in __call__                                                 │
│                                                                                  │
│    43 │   │   if soap_headers:                                                   │
│    44 │   │   │   kwargs["_soapheaders"] = soap_headers                          │
│    45 │   │                                                                      │
│ ❱  46 │   │   return self._proxy._binding.send(                                  │
│    47 │   │   │   self._proxy._client,                                           │
│    48 │   │   │   self._proxy._binding_options,                                  │
│    49 │   │   │   self._op_name,                                                 │
│                                                                                  │
│                                                                                  │
│ /usr/scratch/sess/local/systems-lib/build/dev-venv3.11/lib/python3.11/site-packa │
│ ges/zeep/wsdl/bindings/soap.py:135 in send                                       │
│                                                                                  │
│   132 │   │   if client.settings.raw_response:                                   │
│   133 │   │   │   return response                                                │
│   134 │   │                                                                      │
│ ❱ 135 │   │   return self.process_reply(client, operation_obj, response)         │
│   136 │                                                                          │
│   137 │   async def send_async(self, client, options, operation, args, kwargs):  │
│   138 │   │   """Called from the async service                                   │
│                                                                                  │
│                                                                                  │
│ /usr/scratch/sess/local/systems-lib/build/dev-venv3.11/lib/python3.11/site-packa │
│ ges/zeep/wsdl/bindings/soap.py:229 in process_reply                              │
│                                                                                  │
│   226 │   │   # then assume that an error occured.                               │
│   227 │   │   fault_node = doc.find("soap-env:Body/soap-env:Fault", namespaces=s │
│   228 │   │   if response.status_code != 200 or fault_node is not None:          │
│ ❱ 229 │   │   │   return self.process_error(doc, operation)                      │
│   230 │   │                                                                      │
│   231 │   │   result = operation.process_reply(doc)                              │
│   232                                                                            │
│                                                                                  │
│                                                                                  │
│ /usr/scratch/sess/local/systems-lib/build/dev-venv3.11/lib/python3.11/site-packa │
│ ges/zeep/wsdl/bindings/soap.py:329 in process_error                              │
│                                                                                  │
│   326 │   │   │   if child is not None:                                          │
│   327 │   │   │   │   return child.text                                          │
│   328 │   │                                                                      │
│ ❱ 329 │   │   raise Fault(                                                       │
│   330 │   │   │   message=get_text("faultstring"),                               │
│   331 │   │   │   code=get_text("faultcode"),                                    │
│   332 │   │   │   actor=get_text("faultactor"),                                  │
│                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────╯
Fault: "Invalid UserId 00000000-0000-0000-0000-000000000000"

I am able to use the auth cookie and SOAP API to get the userID, so I'm not sure why it's getting upset/confused about what userID I send. Has anyone else run into this issue?

Tagged:

Best Answer

  • Sam EssSam Ess Tyro
    Answer ✓

    Of course the second I post I see what I did wrong. I had userID when I needed userId

    def get_user_home_folder(transport, userid) -> str:    
        folder_request = {"auth": None, "userID": userid, "allowCreation": False}
        folder_id = client.service.GetPersonalFolderForUser(folder_request)
    

    Whereas I needed

    def get_user_home_folder(transport, userid) -> str:    
        folder_request = {"auth": None, "userId": userid, "allowCreation": False}
        folder_id = client.service.GetPersonalFolderForUser(folder_request)
    

Sign In or Register to comment.