Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Joe VLcek
@jvlcek
@JVue If the user’s Groups list contains the group the want to use the API should be usable to set_current_group to the one the user wants.
JVue
@JVue
^yes, all users already have a list of groups that they go between… so the change would just be within those set groups.
Alexander Braverman Masis
@abraverm
tlv
Miha Pleško
@miha-plesko
hi, is it possible to have REST API return additional fields on model's GET?
like GET /api/something/:id currently returns all models attributes, but I want to render additional one
Martin Hradil
@himdel
@miha-plesko ?expand=resources
(you can also add ?expand=resources,foobar if there's a foobar child)
Miha Pleško
@miha-plesko
@himdel I'm implementing a new API call, not invoking existing one
Martin Hradil
@himdel
there's also ?attributes=foo,bar
ok, then no, I think the endpoint should only return the model, and any extra fields need to come from users adding ?attributes=foo,bar to explicitly add the results of foo and bar virtual attributes
(as far as consistency goes at least)
Miha Pleško
@miha-plesko
okay, then I'll add subcollection to it to make it accessible through ?resources, thanks :thumbsup:
Martin Hradil
@himdel
:+1:
Miha Pleško
@miha-plesko
well @himdel but that doesn't work for has_one relation, does it? Because subcollection is designed for has_many
I'm trying to get userid and endpoint url from my model which has one foreign key to Authentication and another to Endpoint https://github.com/ManageIQ/manageiq/blob/master/app/models/firmware_registry.rb#L5-L6
Martin Hradil
@himdel
@miha-plesko it does...
/api/custom_buttons/2?attributes=resource_action does include resource_action
which is
app/models/custom_button.rb
2:  has_one :resource_action, :as => :resource, :dependent => :destroy, :autosave => true
Miha Pleško
@miha-plesko
aah, I was calling it with wrong, thank you
Martin Hradil
@himdel
np :)
ThomasBuchinger
@ThomasBuchinger
Hello, I am trying to implement the new create_automate_from_git endpoint (ManageIQ/manageiq-api#571). But my domains are created as disabled. I guess it is because enabled: false is the default in MiqAeDomain. Any hints? (btw. my code is over here: https://github.com/ThomasBuchinger/miq-flow/blob/feature/api-provider/lib/miq_flow/pluggable/provider_api.rb#L20)
Joe VLcek
@jvlcek
@ThomasBuchinger I’ll take a look.
Madhu Kanoor
@mkanoor
@ThomasBuchinger thats by design we dont want to import a new domain and enable it automatically. The administrator would have to set the domain to be enabled before they can start start using it.
ThomasBuchinger
@ThomasBuchinger
@mkanoor @jvlcek thanks! Well I am trying to use it in a CI/CD pipeline, so a manual step would be an issue for me... is there a way around it? (ideally one that does not involve ssh to the appliance and execute rails runner, because that is the workaround I hope to replace :) )
ThomasBuchinger
@ThomasBuchinger
Is there any reason, why a (optional) "enabled"-parameter would be a bad idea? I can't find anything in Bugzilla/Github.
Looking at the code, it shouldn't be too complicated to implement ( just add the enabled parameter here ) and I could probalby do it on my own, though I haven't figured out how the UI importer sets the domain to enabled yet
Martin Hradil
@himdel

I haven't figured out how the UI importer sets the domain to enabled yet

@ThomasBuchinger It doesn't, there's a separate toolbar button for enabling a domain.

=> ideally, if we're adding support for enabling domains to the API, it should be a separate action from importing, that way, even the UI can use it

ThomasBuchinger
@ThomasBuchinger
@himdel that is an even better idea. I guess the next step is to open an issue on ManageIQ/manageiq-api? or ManageIQ/manageiq?
Martin Hradil
@himdel
An issue is always good :) I'd say api, since the core already implements it
Miha Pleško
@miha-plesko
hi, were there any recent changes on the api regarding initiated_by parameter when doing POST /requests?
Capture.PNG
Joe VLcek
@jvlcek
@mkanoor and @himdel Thank you for answering the questions from @ThomasBuchinger
@ThomasBuchinger an issue would be great and you could even post a PR if you’d like.
@miha-plesko
curl --user admin:<pw> -k -X GET -H "Accept: application/json" https://${MIQ}/api/requests | jsonpp
Works for me.
@miha-plesko what MiQ version, user? Does the user have a valid role/group?
Miha Pleško
@miha-plesko
@jvlcek i'm on master branch of MIQ using admin user
Joe VLcek
@jvlcek
I’m using master from a week or so ago.
Miha Pleško
@miha-plesko
I think it's this change causing me problems ManageIQ/manageiq#19073
oh, most probably it's just schema migration to apply, lemme try
Joe VLcek
@jvlcek
@miha-plesko could be. My appliance does not have that change, it’s just a tad too old.
Miha Pleško
@miha-plesko
tadaaa it works, thanks for your help
Joe VLcek
@jvlcek
:thumbsup:
ThomasBuchinger
@ThomasBuchinger

@himdel How do you feel about a more generic "edit_attribute"-action, instead of just "set_enabled"?
I have the problem (in a different part of my pipeline), that the last domain to be imported has the highest priority, but I need to insert it between ManageIQ and any custom domains that exist at this point.

This isn't a big pain point for me right now, but it may be useful and shouldn't be a big deal to make it work for multiple attributes. Do you guys have a preference?

Jason Frey
@Fryguy
"edit_attribute" is already a thing via PATCH / PUT
not sure if that particular attribute is patchable though
ThomasBuchinger
@ThomasBuchinger
I am not sure if one would want a generic PATCH function, because I think changing a attribute (most likely) requires additional processing, as the /automate_domains-endpoint isn't backed by a database object, which can be updated automatically. (though I am not that familiar with rails)
Jason Frey
@Fryguy
pretty sure automate_domains is backed by a DB table, but I agree that enabled may not be a simple attribute update (I'd have to check)
Madhu Kanoor
@mkanoor
enabled is a boolean attribute in the MiqAeDomain, but it can only be applied to non system domains like ManageIQ, we don’t want users to disable the ManageIQ domain
Jason Frey
@Fryguy
yeah, but that's easily controllable