Hello, I’ve been trying to use curl and ocs-api to share a file to a NextCloudTalk converation. Note that for development purposes I am using localhost
However the error I’m getting output is that the file could not be found :
<?xml version="1.0"?>
<ocs>
<meta>
<status>failure</status>
<statuscode>404</statuscode>
<message>Wrong path, file/folder does not exist</message>
</meta>
<data/>
</ocs>
What am I doing wrong here ? What does the path need to be ? I both tried this with an absolute path to a local file on my server, and with a path to an uploaded file to NextCloud. Also tried to include the path in the url with no success. Maybe I am overlooking something obvious
Nextcloud Server version: 31.0.2
Operating system and version: Ubuntu 22.04
Looks like the path should be from the perspective of the account you’re sharing from based on the code.
So to share the file blah.txt located in the folder /folder1 from within the admin account (which you’re connecting as), the path to use would be /folder1/blah.txt.
Tip: You can reverse engineer how the Web UI client does shares by using your browser inspector Network tab to look at the request/response payloads (if you’re ever looking for an additional way to cross-reference things).
Yes! Thank you, it is indeed important to look from the perspective of the account that the file will be shared from. It does make sense. In my case the file I wanted to share was located in Talk , thus the appropiate path is “/Talk/example.txt” .
What is curious though is that I will get an error like this :
<?xml version="1.0"?>
<ocs>
<meta>
<status>failure</status>
<statuscode>403</statuscode>
<message>Path is already shared with this conversation</message>
</meta>
<data/>
</ocs>
If the share has already been sent to that conversation, but the duplicate share will still go through. Which honestly is the preferred and expected way of how this should be handled.
There’s now a seperate issue of how I can make it seem like the share was sent by, e.g. user1 instead of admin, but that is unrelated to the issue I had here, I guess I’ll open a seperate ticket for that.
Edit : No need for that now, I simply changed the actor_id in the entry in the database for the message, to the user I want to impersonate as. A bit dirty as a workaround, but I could not find anything better.