Creating a ShareLink with Rest Api

Hello friends, I have been trying to write a simple python program to generate share links for existing folders.
My setup: archlinux running pydio cells community edition on systemd in front of nginx reverse proxy.

A sample folder is named “test” and is in cellsdata/BEM/test. The following json PUT /a/share/link gives me a response 200.

{
  "ShareLink": {
    "Description": "string",
    "Label": "test",
    "PasswordRequired": false,
    "RestrictToTargetUsers": true,
    "Permissions": [
      "Upload",
      "Download"
    ],
    "Policies": [
      {
        "Action": "ANY",
        "Effect": "allow"
      }
    ],
    "RestrictToTargetUsers": true,
    "RootNodes": [
      {
        "Path": "cellsdata/bem/test"
      }
    ]
  }
}

and the response is:

This PUT command produces a good share on the folder (visible though the web gui) but the link gives me the pydio logo with “Loading…” and the grey background. This loading never produces a link that I can use. Making the link using the web gui works. No firefox console errors.

I am having trouble reading the log of pydio but there are no errors, just a lot of debug.

I would add that i suspect that this is a permissions/authentication problem. I’m not sure whether “External Users” are created for each public link or how that works.

I would appreciate any help anyone can offer me. If I can contribute more information, please let me know!

I would also appreciate anybody’s minimum working json to create publicly available sharelinks.

Thank you and merry Christmas and happy holidays.

John

Is there any information that is missing in my post?

Hello @johna,

Indeed when creating an external link, a temporary “role” is created which will hold the rights of the link (until the link is removed).

In your response the user login, is the role (go to the roles interface and on the top right hit the 3 dashes button > show technical roles).

I believe in you api call you are missing the ViewTemplateName parameter (which depends on if it is a file or a folder), could you try with the following body:

{
    "ShareLink": {
        "Label": "folder",
        "Description": "Created on 2021/01/05",
        "ViewTemplateName": "pydio_shared_folder",
        "RootNodes": [
            {
                "Path": "pydiods1/folder"
            }
        ],
        "Permissions": [
            "Download",
            "Preview",
            "Upload"
        ],
        "Policies": [],
        "PoliciesContextEditable": true
    }
}

Oh wow!

Thank you so much @zayn. I really appreciate your help. Your solutions worked. The json you posted worked without any modifications.

I hope this helps future people developing tools on the wonderful tool which is pydio cells.

Kindly

This topic was automatically closed 11 days after the last reply. New replies are no longer allowed.