Create new user using API

Hi everyone, I’m trying to create a new user via API I’m returned this error:

<ocs>
    <script/>
    <script/>
    <meta>
    <status>failure</status>
    <statuscode>999</statuscode>
    <message>
    Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:
</message>
</meta>
<data/>
</ocs>

I skipped a few passes?
I used this API adapted to my site
http://admin:secret@example.com/ocs/v1.php/cloud/users -d userid=“Frank” -d password=“frankspassword”

please, check your servers httpd access log, httpd error log and owncloud.log. Maybe you can find a clue. Query seems okay.

1 Like

here is the error in the owncloud log
{"reqId":"Ac@UbssKuekBBAAAA","level":3,"time":"2017-10-12T16:13:17+00:00","remoteAddr":"88.30.150.99","user":"--","app":"mysql.setup","method":"POST","url":"\/owncloud\/index.php","message":"Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params [\"oc_Mario\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'Sqlowncloud'@'88.46.111.123' for table 'user'"}

This is instead the hosting log:

Tue, 29 May 2018 10:25:46 GMT [error] - www.mysite.com - AH01630: client denied by server configuration: /web/htdocs/www.mysite.com/home/owncloud/data/htaccesstest.txt

can anyone help me? :sob:

It looks like a MySQL permission issue ?
Have you granted full access to the user ‘Sqlowncloud’@88.46.111.123’ to the owncloud database? Not sure if that would break any security default settings though, but you could give a try on a test server.

From within MySQL, you could try…
GRANT ALL PRIVILEGES ON database_name.* TO ‘username’@‘host’;

database_name= the owncloud database name (usually owncloud?)
username@host= ‘Sqlowncloud’@88.46.111.123

1 Like

Hi, I contacted the assistance of my provider and they answered me like this:

Dear Customer,

We invite you to follow the guide at https://doc.owncloud.org/server/10.0/admin_manual/configuration/user/user_provisioning_api.html, to be able to run the indicated line you must include it in a script to be inserted in the web space it is then necessary to call the URL of the script, because currently on shared hosting it is not possible to use the ssh to issue command line commands.

We remain available.

But it’s true ? I understand that I do not have to do anything at ssh level

They answered me :

For the creation of users with specific permissions on shared hosting it is necessary to integrate a script to be executed later by browser.

Do you know where I can get this script to use the shared hoating APIs?
Thanks in advance

help me please :sweat_smile:

I think there is currently something mixed here:

The MySQL error message seems completely unrelated and was originating from October last year (2017).

The support answer looks also quite strange as you can run the command from your own (remote) system and doesn’t need to be executed on the same system ownCloud is running at.

1 Like

Hi, you’re right! Reading the logs are errors that do not concern this operation, so what caused this error?

I think the error is probably that you’re using a wrong query for the API like shown in the message.

1 Like