Access to files in public via absolute URLs

Technical Support

Suggested Topics


  • 0 Votes
    1 Posts
    197 Views

    Hi all,

    I'm trying to use the recently introduced WriteAPI to create topics and concurrently upload a file.
    I'm doing it via Python and I've already succeeded in create a simple topic without a file using something lilke

    payload = { "cid": cid, "title": title, "content": message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=json.dumps(payload))

    but when it's about files using

    payload = { "cid": backstage_cid, "title": backstage_title, "content": backstage_message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' } verifySSL = False print (payload) if (useFile): with open(backstage_file, 'rb') as f: response = requests.request("POST", url, headers=headers, data=payload, verify=verifySSL, files={backstage_file: f})

    it returns
    Error: Required parameters were missing from this API call: cid, title, content cause passing the parameters in a plain dictionary rather than a JSON object seems not doable.

    The switch from JSON to dictionary is needed otherwise I wouldn't have been able to pass a file together with such header

    headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' }

    Has anybody valuable suggestions here?

    Thanks in advance, Riccardo

  • 0 Votes
    2 Posts
    339 Views

    Worked it out.

    In the admin panel:

    Manage>Privileges

    then tick the 'upload files' box for registered users.

  • 1 Votes
    6 Posts
    617 Views

    Here it is.
    0_1540023571272_error.png

  • What URL to Use for SSO

    Technical Support
    0 Votes
    3 Posts
    1k Views

    I'm not for sure, but it could be https://community.mysite.com?loggedin

  • 0 Votes
    6 Posts
    2k Views

    Just tried. Working fine on Vivaldi browser for Ubuntu.