How to use owncloud api

expert
client-development

#1

Excuse me! I want to use owncloud 8.0.8 to devolep an winform app to replace the official windows desktop app with C#,but I don't
know how to use the api ,when I read the developer document ,I can't find the right url! So I hope someone can help me
and give me some suggestions! I can't find help on Google


Owncloud8.0.8 API
Owncloud registerMethod
#2

Hi,

there is no specific API in use. Clients just need to use plain WebDAV calls to the remote.php/dav endpoint of ownCloud.

The official oC sync client is doing some additional stuff like chunking of files but i don't think this is documented somewhere.

Maybe @dragotin or @guruz can say something to this.


#3

If there is no api, why there are some instrument about external API when I read the developer document


#4

Those are APIs for user management and sharing. In the first place you probably need to look into file up/downloading where no API but WebDAV in use as already explained above.


#5

Sorry I'm not sure what's your meaning! Let me ask a easier question, If I want to register a user account and the password ,to see whether the account match the password,which web api shoud I use?


#6

Ok, it might have been easier if you would have explained your use case. The official Desktop app is not registering / creating Users so you're currently asking for something different here as in your initial post.

You can register / create users via an existing API (yes, for this an API exists)

https://doc.owncloud.org/server/9.1/admin_manual/configuration_user/user_provisioning_api.html

Afterwards you can access the WebDAV endpoint of ownCloud at:

http://example.php/remote.php/dav

with the new created credentials via Basic Authentication (Basic Auth). There you can access, upload, download, move and delete files via WebDAV calls the same way the Desktop App is doing it.


#7

Oh, there is some documentation.

First read https://doc.owncloud.org/desktop/2.2/ and especially https://doc.owncloud.org/desktop/2.2/architecture.html for a general overview.

https://github.com/cernbox/smashbox/blob/master/protocol/protocol.md gives detailed information about the sync protocol used.


#8

Thank you,May I knew a little,but I don't know what's the meaning of the url " http://admin:secret@example.com/ocs/v1.php/cloud/users -d userid="Frank" -d password="frankspassword" " for example : the install address of the owncloud is in my own computer ,
localhost/owncloud,if I use the API to create a user ,what's the final url should I write!
and the code I write is like this:
var client = new HttpClient();
string res = await client.GetStringAsync(" http://localhost/owncloud/ocs/v1.php/cloud/users?search=admin");
XmlDocument doc = new XmlDocument();
doc.LoadXml(res);
XmlNodeList xx = doc.GetElementsByTagName("status");
foreach(XmlNode xxnode in xx)
{
Console.WriteLine("status:"+xxnode.InnerText);
}
But when I debug it,it prompts (Unauthorized)。


#9

Your code example lacks the authentication information coming along with GetStringAsync(). You somehow must specify the user and password that is sent along with that call.