Share with api - questions

Hi,
I’m using the below code, it:

  1. create a new folder under the main folder.
  2. Upload a file to it.
  3. Share it with an internal link.
  4. get the link and post it somewhere.

My issue is that a registered user that belongs to a group called support is not capable to download the file, and he needs to accept the file share. (see pic below)
What shell I do to overcome it?
slack_5rHCf10dSu

The below code is in Python:

main_nc_folder = '/ZD_TICKETS/ZD#'
    if success_login_nc:
        try:
            oc.mkdir(main_nc_folder + ticket_id)
            oc.share_file_with_group(main_nc_folder + ticket_id, 'Support')
        except owncloud.HTTPResponseError as res:
            if res.status_code == 405:
                logger.info(f"Folder {ticket_id} already exists. continue")
        try:
            oc.put_file(main_nc_folder + ticket_id + '/' + os.path.split(seven_z_upload_file)[1],
                        seven_z_upload_file)
        except Exception as e:
            logger.info(f"ERROR - {e}")
        # link_temp = None
        filename_location = (main_nc_folder + ticket_id +
                             '/' + os.path.split(seven_z_upload_file)[1])
        try:
            # notice this change https://github.com/owncloud/pyocclient/pull/255/commits/60314c957b2cce4e91b1a9445d0c6bd6b9e85e72
            link_temp = oc.share_file_with_group(filename_location, 'Support')
            if link_temp:
                return 'https://nc.x.com/index.php/f/' + link_temp.share_info['item_source']
            if not link_temp:
                link_temp = oc.get_shares(filename_location)
                return 'https://nc.x.com/index.php/f/' + link_temp[0].share_info['item_source']
        except owncloud.HTTPResponseError as res:
            if res.status_code == 401:
                logger.info("folder already shared to group. continue")
                link_temp = oc.get_shares(filename_location)
                return 'https://nc.x.com/index.php/f/' + link_temp[0].share_info['item_source']

appreciate your prompt response.

I posted an answer that also share a folder here: Create a folder and share link programatically

May it could help. :wink: