Introduction¶
Nextcloud-API is Python (2 and 3) wrapper for NextCloud’s API. With it you can manage your NextCloud instances from Python scripts.
If you have any question, remark or if you find a bug, don’t hesitate to open an issue.
Quick start¶
First, create your NextCloud instance:
import sys
import os
from os.path import dirname
from os.path import join
sys.path.insert(0, join(dirname(__file__), 'src'))
from nextcloud import NextCloud
NEXTCLOUD_URL = "http://{}:80".format(os.environ['NEXTCLOUD_HOSTNAME'])
NEXTCLOUD_USERNAME = os.environ.get('NEXTCLOUD_ADMIN_USER')
NEXTCLOUD_PASSWORD = os.environ.get('NEXTCLOUD_ADMIN_PASSWORD')
# True if you want to get response as JSON
# False if you want to get response as XML
to_js = True
nxc = NextCloud(endpoint=NEXTCLOUD_URL, user=NEXTCLOUD_USERNAME, password=NEXTCLOUD_PASSWORD, json_output=to_js)
Then you can work with NextCloud objects:
nxc.get_users()
new_user_id = "new_user_username"
add_user_res = nxc.add_user(new_user_id, "new_user_password321_123")
group_name = "new_group_name"
add_group_res = nxc.add_group(group_name)
add_to_group_res = nxc.add_to_group(new_user_id, group_name)
Which API does it support?¶
API name | Implementation status | Last checked date |
---|---|---|
User provisioning API | OK | 2019-02-02 |
OCS Share API | Partially implemented | 2019-02-02 |
WebDAV API | OK | 2019-02-02 |
Activity app API | OK | 2019-02-02 |
Notifications app API | OK | 2019-02-02 |
The LDAP configuration API | OK | 2019-02-02 |
Capabilities API | OK | 2019-02-02 |
Group Folders API | OK | 2019-02-02 |
Download and install¶
python setup.py install
License¶
Nextcloud-API is licensed under the GNU General Public License v3.0.
What’s next ?¶
Check Examples and Nextcloud-API.