Use the API with ruby

I tried to use the API (v1 and v2) to create groups and create group folders. Unfortunately, I wasn’t able to get anything to work with the Rest API.

Firstly, I tried to use https://github.com/dachinat/nextcloud but I got always a 400 response instead of any result. Later on, I used the Rest API directly - without any luck.

Some more information what I tried to use:

  • use username + password
  • use username + “app-password” (created in User -> Security)
  • v1 and v2

Do I need to configure anything to use the API?

Can someone share example code (any programming language) which uses the current NextCloud 18 Rest API.

I didn’t use it with NC18, but the python client was working: https://github.com/owncloud/pyocclient

Thanks. This library uses v1 api. Are there other examples available using v2 api?

One additional important hint: The nextcloud istance is using SAML but I want to use non-saml account to use the API. The account works in case I login with /login?direct=1 on the browser.

Do I need to consider this while using the API?

After fixing some other issues, I can confirm

  • the https://github.com/dachinat/nextcloud ruby api client still works
  • even if you have user_saml it works
  • have a look at trusted-domain configuration
  • debug it via “Logging” menu in Nextcloud Admin Menu
  • make sure your user/pass credentials are right, check it twice!