Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
ashkuren
@ashkuren
is this a standard enpoint /api/automations ?
Rashed Mehmood
@rashidramk
This is valid type of request, the main issue is, it is converting POST request to GET and then error comes as invalid id. As I mentioned same request is working with version ivanchuk and I checked the log and it is still POST request.

is this a standard enpoint /api/automations ?

I'm adding custom API. Its working fine on other VM.

Jason Frey
@Fryguy
right, I'm asking whether you hvae this POST/GET switch with other endpoints like, say, /api/vms
Rashed Mehmood
@rashidramk

right, I'm asking whether you hvae this POST/GET switch with other endpoints like, say, /api/vms

Yes, check with "POST /api/vms/42" for testing and it still switch POST to GET

[----] I, [2021-06-18T10:32:09.115762 #8947:2ae9ec479158] INFO -- : MIQ(Api::VmsController.log_request_initiated)
[----] I, [2021-06-18T10:32:09.116077 #8947:2ae9ec479158] INFO -- : MIQ(Api::VmsController.log_request) API Request: {:requested_at=>"2021-06-18 14:32:09
UTC", :method=>"GET", :url=>"https://10.0.2.4/api/vms/42"}
[----] I, [2021-06-18T10:32:09.433697 #8947:2ae9ec479158] INFO -- : MIQ(Api::VmsController.log_request) Authentication: {:type=>"basic", :token=>nil, :xmiq
group=>nil, :user=>"admin"}
ashkuren
@ashkuren
what do you have in the body?
Rashed Mehmood
@rashidramk

what do you have in the body?

Body:
{"action": "post_automation",
"endpoint": "test"
}

ashkuren
@ashkuren
what protocol do you use? http?
Rashed Mehmood
@rashidramk

what protocol do you use? http?

Yes.

ashkuren
@ashkuren
try https. it could be because of redirects
Rashed Mehmood
@rashidramk

try https. it could be because of redirects

AAh. Okay sure, I'll try using https.

Andrey Menezes
@AndreyMenezes
Hi Guys, I'm trying to create user groups using API. Then, I have to create a filter_expression for this group using this code:
curl -k -X POST --user admin:'redhat' -H 'Content-Type: application/json' -H 'cache-control: no-cache' https://10.111.9.8/api/groups -d '{ "description": "999992RJ", "role": { "id": "1000000000028" }, "tenant": { "id": "1000000000078" }, "filter_expression": { "exp": { "not": { "CONTAINS": { "tag": "managed-prov_scope", "value": "000000rj" } } } } }'
But aways get this error: {"error":{"kind":"internal_server_error","message":"unknown attribute 'filter_expression' for MiqGroup.","klass":"ActiveModel::UnknownAttributeError"}}
Andrey Menezes
@AndreyMenezes
@pemcg so, is this a bug?
Peter McGowan
@pemcg
I think so
Andrey Menezes
@AndreyMenezes
Hi guys, how to tag cloud volume types using API?
Jed Barson
@jbarson47

Hey guys, I am trying to set a retirement date for a VM through the ManageIQ API and was wondering if anyone is aware of a viable method to do this.

I see that the ManageIQ docs mention that a retirement date can be set in the future via the API for services (using request_retire action and date in the resource), but this option doesn’t seem to work for VMs (the VM is just retired immediately when attempting this). I have also tried using the edit action on the VM but retires_on is not an editable value for VMs.

Is anyone familiar with a solution for setting a VM retirement date through the API? I am running CloudForms 5.11.9.0 for reference.

Nick LaMuro
@NickLaMuro
:eyes:
Nick LaMuro
@NickLaMuro

@jbarson47 Looks like queuing a retirement using request_retire was not added until jansa, which was after the last release of CloudForms (if I remember correctly):

ManageIQ/manageiq-api#813

so that is why that functionality doesn't exist in your version

Jed Barson
@jbarson47
@NickLaMuro Got it, yup that checks out. Thanks a bunch.
Keenan Brock
@kbrock
@bdunne or @agrare ManageIQ/manageiq-api#1079
Does this API OPTIONS look about right?
Or do you want me to try and get this into the base OPTIONS calls? (hard when the various models act so differently)
Adam Grare
@agrare
yeah looks good, much better than re-implementing in every collection
Mohamed ELgamasy
@moelgamasy
Hello All
i would like to ask about api with metrics {Ex: get usage resources }
Adam Grare
@agrare
hey @moelgamasy looks like there is an API for metric_rollups: https://www.manageiq.org/docs/reference/latest/api/reference/metric_rollups.html
don't see anything for /metrics realtimes, should be able to be added relatively easily though if that is what you're looking form
Mohamed ELgamasy
@moelgamasy
@agrare i tried to it but it's not return anything
Adam Grare
@agrare
do you have metric rollups?
Mohamed ELgamasy
@moelgamasy
we should first added it ?
@agrare
Adam Grare
@agrare
I mean do you have any metric_rollups records in your database?
not returning anything would be correct if there were no records ;)
Mohamed ELgamasy
@moelgamasy
this api already not exists in cloudforms APIs
https://i.imgur.com/rNLDpSc.png
@agrare i don't understand this point , i think the metric_rollups should already exists with exists VM
right ?
Adam Grare
@agrare

this api already not exists in cloudforms APIs

This API has been there for a number of years: ManageIQ/manageiq-api#4

GET /api/metric_rollups
{
  "error": {
    "kind": "bad_request",
    "message": "Must specify resource_type, capture_interval, start_date",
    "klass": "Api::BadRequestError"
  }
}

i don't understand this point , i think the metric_rollups should already exists with exists VM

well if you don't have c&u enabled then you won't have any metrics or metric_rollups records

Adam Grare
@agrare
how are you issuing your API call?
GET /api/metric_rollups?resource_type=VmOrTemplate&capture_interval=hourly&start_date=2021-11-11
{
  "count": 226,
  "subcount": 1,
  "subquery_count": 1,
  "pages": 1,
  "resources": [
    {
      "href": "https://manageiq.rb.nj.grare.com/api/metric_rollups/226"
    }
  ],
  "links": {
    "self": "https://manageiq.rb.nj.grare.com/api/metric_rollups?resource_type=VmOrTemplate&capture_interval=hourly&start_date=2021-11-11&offset=0",
    "first": "https://manageiq.rb.nj.grare.com/api/metric_rollups?resource_type=VmOrTemplate&capture_interval=hourly&start_date=2021-11-11&offset=0",
    "last": "https://manageiq.rb.nj.grare.com/api/metric_rollups?resource_type=VmOrTemplate&capture_interval=hourly&start_date=2021-11-11&offset=0"
  }
}
Mohamed ELgamasy
@moelgamasy
i tried with the same api format and already enable C&U feature
but still the same
Adam Grare
@agrare
if you ssh to your appliance you can check if you have metric rollups records by doing cd /var/www/miq/vmdb; bin/rails c then MetricRollup.count
can you also post your API call and the response?
Mohamed ELgamasy
@moelgamasy

GET /api/metric_rollups?resource_type=Vm&capture_interval=hourly&start_date='2021-10-22 08:57:52 -0400'
<!DOCTYPE html>

<html>

<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body {
background-color: #fff;
color: #666;
text-align: center;
font-family: arial, sans-serif;
}

div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}

h1 {
font-size: 100%;
color: #f00;
line-height: 1.5em;
}
</style>
</head>

<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>

</html>

Jason Frey
@Fryguy
I'm surprised you get a 404 HTML page at all (would have expected a JSON response)
Mohamed ELgamasy
@moelgamasy
this for cd /var/www/miq/vmdb; bin/rails c then MetricRollup.count
Adam Grare
@agrare
yeah also suprised you got a 404, what version is this? cat /var/www/miq/vmdb/BUILD