[katello] API curl format question

Dear List,

I am trying to install telnet RPM on a client using katello API with curl.
Following the documentation it must be:

··· ----------------------------------------------------------------------------- POST /api/v2/systems/:system_id/packages/install

using packages and group parameters

I have tried with no success:

curl -k -u user:pass,. -X POST -H ‘Accept: application/json’

https://server.example.com/katello/api/v2/systems/e010c75a-3248-4d4c-a4bd-701fc2f22d75/packages/install?packages=telnet

Please can anybody show me how can I perform correctly this action using
’curl’ API call ?

Many thanks in advance,
Benja.

What error are you seeing?

··· On Fri, Mar 27, 2015 at 9:30 AM, benja wrote:

Dear List,

I am trying to install telnet RPM on a client using katello API with curl.
Following the documentation it must be:


POST /api/v2/systems/:system_id/packages/install

using packages and group parameters


I have tried with no success:

curl -k -u user:pass,. -X POST -H ‘Accept: application/json’

https://server.example.com/katello/api/v2/systems/e010c75a-3248-4d4c-a4bd-701fc2f22d75/packages/install?packages=telnet

Please can anybody show me how can I perform correctly this action using
’curl’ API call ?

Many thanks in advance,
Benja.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

> What error are you seeing?
>
>
> > Dear List,
> >
> > I am trying to install telnet RPM on a client using katello API with curl.
> > Following the documentation it must be:
> >
> >
> > -----------------------------------------------------------------------------
> > POST /api/v2/systems/:system_id/packages/install
> >
> > using packages and group parameters
> >
> > -----------------------------------------------------------------------------
> >
> > I have tried with no success:
> >
> > # curl -k -u user:pass,. -X POST -H 'Accept: application/json'
> > https://server.example.com/katello/api/v2/systems/e010c75a-3248-4d4c-a4bd-701fc2f22d75/packages/install?packages=telnet
> >
> > Please can anybody show me how can I perform correctly this action using
> > 'curl' API call ?
> >
> > Many thanks in advance,
> > Benja.

Since you're POSTing data, i think you'll want to pass the data as an argument as opposed to params on the end
of the url. Also be sure to set the content-type header to json as well.

curl -k -u user:pass -X POST
-H 'Accept: application/json' -H 'Content-Type: application/json'
-d '{"packages":["telnet"]}'
https://server.example.com/katello/api/v2/systems/e010c75a-3248-4d4c-a4bd-701fc2f22d75/packages/install

try that

··· ----- Original Message ----- > On Fri, Mar 27, 2015 at 9:30 AM, benja wrote:


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

  • adam price