API. Create a mysql database with curl

speckados

Well-Known Member
I use the api via root, for actions like WHM and Cpanel.

In the chaos of creating a database and a mysql user associated with it, I don't see that there is an api call from whm, and I understand that there should be an option like the ones I use to create an addon domain, that is, a call to port 2087 but using cpanel_jsonapi_version 2 and its corresponding module.

But, I do not see it.

The most I see is the use of UAPI having to use port 2083.

Is this the only way?
 

speckados

Well-Known Member
I don't need explain how to use.I need to find the endpoint.

Example:
For create addon use

I go to manual of cpanel and there're a entry for creat add on domain.

I go to cpanel's docs, to google, and the're not a endpoint for add a database, use database, for one account.

Also the're not a funciontion for API 1,
Example:


In all two examples use a TOKEN create in WHM.

¿Ther're are a endpoint for add mysql database, add user mysql associate to user cpanel?

That is the question.

Best regards.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
11,700
1,858
363
cPanel Access Level
Root Administrator
I looked through the API just now - both the new docs and the old documentation site - and I'm not seeing a root method to create a database. Create MySQL database · cPanel & WHM Developer Portal is the best option we have for that currently.

If you'd like to see an additional API function added, can you make a feature request for that using the link in my signature?
 

speckados

Well-Known Member
Yes,. This work around that I use for my work. Incredible that API has not a method direct for root.

It is an API in halves, which requires the use of upai or console commands, instead of doing it with the API itself.

Very deficit.

Thanks for your replies @cPRex