You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by JeanPaul van der Mijle <jp...@hyperai.ai> on 2023/07/14 08:13:19 UTC
API questions
Hi all,
I am trying to create accounts using the API. However, upon sending the request, I always get the error back about "invalid credentials or signature".
My code is as follows:
$command['command'] = "createUser";
$command['account'] = $username;
$command['email'] = $email;
$command['firstname'] = $firstname;
$command['lastname'] = $lastname;
$command['password'] = $password;
$command['username'] = $username;
ksort($command);
$command['signature'] = $this->sign(http_build_query($command));
$command['apikey'] = $this->apikey;
$command['response'] = "json";
$link = $this->baseurl . http_build_query($command);
$result = $this->call_api($link);
var_dump($command);
var_dump($result);
I am using the same commands and order for other commands, but there it works fine (listUsers, listServiceOfferings etc, with additional options as well), however attempting to create accounts fails. Is this a known bug or am I do something wrong with the order for signing?
Thank you.
JeanPaul
Re: API questions
Posted by Daan Hoogland <da...@gmail.com>.
What do you mean by the panel? I mean mostly with a API tool, thought the
UI uses the API as well.
So can you only execute list commands or can you also create other things
(networks, VMs, network rules, and Accounts)?
On Fri, Jul 14, 2023 at 10:48 AM JeanPaul van der Mijle <
jp.vandermijle@hyperai.ai> wrote:
> Hi Daan,
>
> The API keys currently used are from the admin user. I assume admin user
> is able to create accounts via API, as I am able to do it in the panel
> manually using the admin user.
>
> Thanks,
>
> JeanPaul
>
>
> ________________________________
> From: Daan Hoogland <da...@gmail.com>
> Sent: Friday, July 14, 2023 10:26 AM
> To: users@cloudstack.apache.org <us...@cloudstack.apache.org>
> Subject: Re: API questions
>
> first thought JeanPaul,
> Is the user with these credentials (apikey/secretkey) allowed to execute
> creatUser?
>
> On Fri, Jul 14, 2023 at 10:13 AM JeanPaul van der Mijle <
> jp.vandermijle@hyperai.ai> wrote:
>
> > Hi all,
> >
> > I am trying to create accounts using the API. However, upon sending the
> > request, I always get the error back about "invalid credentials or
> > signature".
> >
> > My code is as follows:
> >
> > $command['command'] = "createUser";
> > $command['account'] = $username;
> > $command['email'] = $email;
> > $command['firstname'] = $firstname;
> > $command['lastname'] = $lastname;
> > $command['password'] = $password;
> > $command['username'] = $username;
> > ksort($command);
> >
> > $command['signature'] = $this->sign(http_build_query($command));
> > $command['apikey'] = $this->apikey;
> > $command['response'] = "json";
> >
> > $link = $this->baseurl . http_build_query($command);
> > $result = $this->call_api($link);
> > var_dump($command);
> > var_dump($result);
> >
> > I am using the same commands and order for other commands, but there it
> > works fine (listUsers, listServiceOfferings etc, with additional options
> as
> > well), however attempting to create accounts fails. Is this a known bug
> or
> > am I do something wrong with the order for signing?
> >
> > Thank you.
> >
> > JeanPaul
> >
>
>
> --
> Daan
>
--
Daan
Re: API questions
Posted by JeanPaul van der Mijle <jp...@hyperai.ai>.
Hi Daan,
The API keys currently used are from the admin user. I assume admin user is able to create accounts via API, as I am able to do it in the panel manually using the admin user.
Thanks,
JeanPaul
________________________________
From: Daan Hoogland <da...@gmail.com>
Sent: Friday, July 14, 2023 10:26 AM
To: users@cloudstack.apache.org <us...@cloudstack.apache.org>
Subject: Re: API questions
first thought JeanPaul,
Is the user with these credentials (apikey/secretkey) allowed to execute
creatUser?
On Fri, Jul 14, 2023 at 10:13 AM JeanPaul van der Mijle <
jp.vandermijle@hyperai.ai> wrote:
> Hi all,
>
> I am trying to create accounts using the API. However, upon sending the
> request, I always get the error back about "invalid credentials or
> signature".
>
> My code is as follows:
>
> $command['command'] = "createUser";
> $command['account'] = $username;
> $command['email'] = $email;
> $command['firstname'] = $firstname;
> $command['lastname'] = $lastname;
> $command['password'] = $password;
> $command['username'] = $username;
> ksort($command);
>
> $command['signature'] = $this->sign(http_build_query($command));
> $command['apikey'] = $this->apikey;
> $command['response'] = "json";
>
> $link = $this->baseurl . http_build_query($command);
> $result = $this->call_api($link);
> var_dump($command);
> var_dump($result);
>
> I am using the same commands and order for other commands, but there it
> works fine (listUsers, listServiceOfferings etc, with additional options as
> well), however attempting to create accounts fails. Is this a known bug or
> am I do something wrong with the order for signing?
>
> Thank you.
>
> JeanPaul
>
--
Daan
Re: API questions
Posted by Daan Hoogland <da...@gmail.com>.
first thought JeanPaul,
Is the user with these credentials (apikey/secretkey) allowed to execute
creatUser?
On Fri, Jul 14, 2023 at 10:13 AM JeanPaul van der Mijle <
jp.vandermijle@hyperai.ai> wrote:
> Hi all,
>
> I am trying to create accounts using the API. However, upon sending the
> request, I always get the error back about "invalid credentials or
> signature".
>
> My code is as follows:
>
> $command['command'] = "createUser";
> $command['account'] = $username;
> $command['email'] = $email;
> $command['firstname'] = $firstname;
> $command['lastname'] = $lastname;
> $command['password'] = $password;
> $command['username'] = $username;
> ksort($command);
>
> $command['signature'] = $this->sign(http_build_query($command));
> $command['apikey'] = $this->apikey;
> $command['response'] = "json";
>
> $link = $this->baseurl . http_build_query($command);
> $result = $this->call_api($link);
> var_dump($command);
> var_dump($result);
>
> I am using the same commands and order for other commands, but there it
> works fine (listUsers, listServiceOfferings etc, with additional options as
> well), however attempting to create accounts fails. Is this a known bug or
> am I do something wrong with the order for signing?
>
> Thank you.
>
> JeanPaul
>
--
Daan