XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Trouble Creating VM via API

    Scheduled Pinned Locked Moved Solved REST API
    18 Posts 3 Posters 412 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • olivierlambertO Offline
      olivierlambert Vates đŸȘ Co-Founder CEO
      last edited by

      The right URL is:
      https://<XO URL>/rest/v0/docs/

      B 1 Reply Last reply Reply Quote 0
      • B Offline
        bryonadams @olivierlambert
        last edited by

        @olivierlambert That worked, and is exactly what I was looking for in the API docs but overlooked. Are there plans to put this type of API explorer/documentation on the documentation website or is the expectation that we'll interact with XO directly for documentation of API endpoints?

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Offline
          olivierlambert Vates đŸȘ Co-Founder CEO
          last edited by

          Swagger doc is auto generated, and yes it's planned to have a button in XO 6 to access it directly. Note we communicate often (almost each release announcement) of our swagger doc.

          1 Reply Last reply Reply Quote 0
          • lsouai-vatesL Offline
            lsouai-vates Vates đŸȘ Product team XO Team @bryonadams
            last edited by

            Keys or values from a GET should be usable in a POST.

            @bryonadams I understand your point of view and the reasoning behind it. However, it’s not always an absolute rule that every field returned by a GET endpoint can be passed back to a POST (or PUT).

            In this case, the API error message you received clearly indicates that these parameters are “excess properties not allowed”, meaning they cannot be used as input parameters.

            Indeed, it also seems you’re not running the latest version of XO. Could you please check again? You should be getting the recent REST API updates:
            https://github.com/vatesfr/xen-orchestra/pull/8798

            We’re currently in the process of migrating from the old REST API to the new one, so for now Swagger remains the single source of truth. As @olivierlambert mentioned, we plan to provide direct access to it from XO-6, and we’ve been communicating about this in our blog posts.

            MathieuRA opened this pull request in vatesfr/xen-orchestra

            closed feat(@vates/types): enhance createVm type #8798

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              bryonadams @lsouai-vates
              last edited by bryonadams

              @lsouai-vates said in Trouble Creating VM via API:

              @bryonadams I understand your point of view and the reasoning behind it. However, it’s not always an absolute rule that every field returned by a GET endpoint can be passed back to a POST (or PUT).

              Sorry, I don't think I was clear. The keys are different for the same thing. Depending on where you look, autoPowerOn or auto_poweron is returned.

              eg:

              • ..rest/v0/pools/_/actions/create_vm/ returns the key "auto_poweron",
              • /rest/v0/vms/de320b24-d768-50f4-6226-b48f64f85a55 (my example vm) returns the key "auto_poweron"
              • Swagger doesn't seem to have this key as far as I can tell, unless I'm looking at the wrong thing. I only see a way to filter by tags.

              @lsouai-vates said in Trouble Creating VM via API:

              Indeed, it also seems you’re not running the latest version of XO. Could you please check again? You should be getting the recent REST API updates:

              I don't know how I can be more up to date than up to date.

              49b5e84e-8e5e-4df6-9083-c90d3fe7a541-image.png

              lsouai-vatesL 1 Reply Last reply Reply Quote 0
              • lsouai-vatesL Offline
                lsouai-vates Vates đŸȘ Product team XO Team @bryonadams
                last edited by

                @bryonadams Can you precise if you are using XO from source or from XOA?

                The update action you are dispalying is for XOA, and our XOA is now on 5.109.1...

                04c66e8b-5412-414c-9e19-8226ccb088a4-image.png

                If you are using it from source, please follow https://docs.xen-orchestra.com/installation#updating

                B 1 Reply Last reply Reply Quote 0
                • B Offline
                  bryonadams @lsouai-vates
                  last edited by

                  @lsouai-vates I'm using from XOA, not from source. Should I be using latest instead of stable?

                  lsouai-vatesL 1 Reply Last reply Reply Quote 0
                  • lsouai-vatesL Offline
                    lsouai-vates Vates đŸȘ Product team XO Team @bryonadams
                    last edited by

                    @bryonadams as you are on XOA, you should switch on latest to get the last udpates yes 🙂
                    Hope it will help!

                    B 1 Reply Last reply Reply Quote 0
                    • B Offline
                      bryonadams @lsouai-vates
                      last edited by

                      @lsouai-vates After updating I still see the inconsistency, if it helps. I'll stick to the swagger doc if that's the correct source of truth. I was only querying this way because the docs suggested it as a method.

                      a91f6c98-1d42-4b8b-8285-8b1d216ff737-image.png
                      dd0a1a91-04eb-4bee-9805-2150a0bc6ffb-image.png

                      Is there a place I can submit a feature request to allow setting a description and other settings from the UI to get feature parity when creating a VM? Otherwise, there's not much point since I have to go in and touch the new VM anyway. Unless I'm going about this wrong to begin with?

                      lsouai-vatesL 1 Reply Last reply Reply Quote 0
                      • lsouai-vatesL Offline
                        lsouai-vates Vates đŸȘ Product team XO Team @bryonadams
                        last edited by

                        @bryonadams said in Trouble Creating VM via API:

                        Is there a place I can submit a feature request to allow setting a description and other settings from the UI to get feature parity when creating a VM? Otherwise, there's not much point since I have to go in and touch the new VM anyway. Unless I'm going about this wrong to begin with?

                        You can create a feature request on Xen Orchestra github repository (https://github.com/vatesfr/xen-orchestra/issues), and if you have subscribed to support via XOA you can send a request through Zammad.

                        1 Reply Last reply Reply Quote 0
                        • olivierlambertO olivierlambert marked this topic as a question
                        • olivierlambertO olivierlambert has marked this topic as solved
                        • First post
                          Last post