API broken in nextcloud

I’m trying to get the API to work, but it simply doesn’t. I’m trying to use a module developed for OwnCloud by HostBill. Their developer reported back that it is a bug in NextCloud. I’ have tested myself, trying to do basic API-calls (without any modules, just straigth API-calls like demonstrated in the manual), but they are all denied from the API - I have even tried new users. Can it be that there are just something I do wrong? That I have to enable something more than in OwnCloud?

I have raised an issue here, but I don’t know how many days, month, years it will take…

Did you try this command from the docs first?
https://docs.nextcloud.com/server/12/developer_manual/client_apis/OCS/index.html#testing-requests-with-curl

I tried to get the user data and it works for me on NC 12 (ā€œdefaultā€ setup on debian + apache+mod_php). If you use second factor authentication, don’t forget to set an app password for shell access.

The secred might be found in the fact not to send username and uncrypted passwords (or AppIDs) within an URL as they could be read and stored by everyone in logs, routers, proxies.

https://tools.ietf.org/html/rfc2617#section-3

I have tried it with CURL yes. Same result. I also changed from php-fcgi to php-module, with little changes.

Maybe I can hope it is only a bug in the one cPanel/Softalcious provides (or some kind of security-blocks). Will test on another server, hopefully, it works.

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>failure</status>
  <statuscode>997</statuscode>
  <message>Current user is not logged in</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data/>

This has shown to be a bit tricky in the past (check other topics) because we are here no experts of these panel software which alters the default settings

I noticed some weird behaviour too with Hostbill and NextCloud.
It can connect successfully to my NextCloud server, but as soon as I try to create an account with Hostbill it can’t connect anymore.(Error: Unauthorised)
I get the following in the NextCloud logs:

Error: Call to undefined method [obfuscated class]::createuser() at /var/www/nextcloud/apps/api_hostbill/lib/helper.php#32
Error: Class ā€˜OC_Group’ not found at /var/www/nextcloud/apps/api_hostbill/lib/helper.php#163

As I don’t own the OpenSource code for the Hostbill module I can’t change/see anything in there.

–
Both servers have the latest version.
Hostbill and NextCloud runs each on an own KVM. No cPanel or anything else.

A different app solved it like this:

So you need to notify the developers of api_hostbill that they update their app for NC12.

1 Like

@JasonBayton I’m in favor to close this issue. It’s clearly a problem of the hoster’s closed-source app, so we can’t really do anything more.

If their developers find something broken in the api, they should better report directly to github, it’s hard to guess what is messed up and it’s clearly their support who should solve this.

1 Like

Yup seconded. Folks you’ve done some great troubleshooting but as it’s an issue with their app you’re better off raising the issue with them directly. By all means update the GitHub ticket with what you’ve tested here though I imagine it’ll be closed off once the Devs validate it working.

If there’s a valid reason to reopen this please PM myself or @tflidd

2 Likes