Upload via API

Home Forums Developers Upload via API

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Chris KurrKurr 2 weeks, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #114412
    Profile photo of Chris
    KurrKurr
    Participant

    Hi,

    I’m trying to fix a script that uploads a file to a workspace. I’m using Python 2.7 and in v6 it worked flawlessly. Now in Pydio v8 it doesn’t work anymore!

    Earlier the upload was done like so:

    requests.put("https://mypydioserver/api/workspacename/upload/put/", data=f, headers={'X-File-Name': 'README.txt'}, auth=creds_u,verify=False)

    (“f” is a python file object.)

    This doesn’t work anymore! I get the error

    <?xml version="1.0" encoding="UTF-8"?><tree ><message type="ERROR">Could not find any endpoint for this URI</message></tree>

    Now I saw in the really shitty documentation, that there’s a new API (v2). I tried it out and made some progress, with

    requests.put("https://mypydioserver/api/v2/io/workspacename/README.txt", data=f, auth=creds_u,verify=False)

    but this results in the error

    <?xml version="1.0" encoding="UTF-8"?><tree ><message type="ERROR">Warning, missing Content-Length header.</message></tree>

    I already tried setting the Content-Length header manually, but it doesn’t work.

    I’m just trying to store a simple text file for a user, when a new user is created programmatically.

    Does anybody know some undocumented upload endpoints I can use? The first one, “upload/put” wasn’t documented either, or rather the documented one (“sth/sth/input_stream/dir+”) doesn’t work either.

    Best regards,
    Chris


    #114413
    Profile photo of Chris
    KurrKurr
    Participant

    I fixed it by NOT using a Python TempFile-Object, but rather a regular file on disk, that I create, close, read into the request and delete afterwards.

    API v2 works this way. API v1 is still broken.

    Chris


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.