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

    REST API

    Xen Orchestra
    in backlog
    4
    9
    331
    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.
    • delafD
      delaf
      last edited by marcungeschikts

      Hello,

      We start using the REST API.
      As I did not see evolution on it since some months, I would like to know what is the status and what are the plan of this API?

      Today the most problematic part I have is the lack of rights in the API : the user must be an admin and have read/write access (even if for now the write access is quite limited as it is only "VDI Import"), and so have access to all ressources.

      We are only using Collections for now to get VM list, and VM info (ram, disk, cpu), and so far so good ๐Ÿ˜‰

      Regards,

      1 Reply Last reply Reply Quote 0
      • olivierlambertO
        olivierlambert Vates ๐Ÿช Co-Founder๐Ÿฆธ CEO ๐Ÿง‘โ€๐Ÿ’ผ
        last edited by olivierlambert

        Hi!

        1. The plan is to add more feature as users ask. So this is user driven, since we can't guess priorities without people asking ๐Ÿ™‚
        2. What do you expects concretely in terms of features? Can you please provide actual use cases?
        delafD 1 Reply Last reply Reply Quote 0
        • delafD
          delaf @olivierlambert
          last edited by

          @olivierlambert
          For now, we are using the REST API to integrate information about VM into our ERP. We are tracking changes over time and are providing an up to date inventory to our customers.

          Next step for us, would be able to create VM directly through the REST API (and not via xo-cli, or xe).
          But on the security side, we will need to be able to restrict API users to some objects as the system must not be able to view/modify some objects (mostly do not be able to get/set info for some pools). Even further, we could imagine that each customer has 2 API KEY (one read, the other read/write) that will be restricted to the customer pool or customer VM.

          To help people to use the REST API, it would be nice if xo-web can generate the API KEY.

          Regards,

          1 Reply Last reply Reply Quote 0
          • olivierlambertO
            olivierlambert Vates ๐Ÿช Co-Founder๐Ÿฆธ CEO ๐Ÿง‘โ€๐Ÿ’ผ
            last edited by

            Hi!

            For the last point, I invite you stay tuned being read carefully each XO release blog post. It's available in XO 5.72 since last June, see https://xen-orchestra.com/blog/xen-orchestra-5-72/#๐Ÿ“ก-rest-api-token-generation

            For the REST API, we recently added (but not published in a blog post, will be for November release) GET on snapshots (VM and VDI) + VM templates. So more objects to view from there ๐Ÿ™‚

            However, there's a big gap with POST actions (doing "actions" in short). Since almost all operations are async, like disk or VM creation, REST needs to be tuned for that. I would say it's the "hard" part in REST vs a connected API like xo-cli with websockets and its persistent connection. We will probably use a "queue" system you can request to get the status of the task and the answer. Eg the UUID of the freshly created VM. All in all, it's more complex and can't be done quickly like adding "GET" actions ๐Ÿ™‚

            Finally, the permissions IMHO are even more complex, we need to discuss that with @julien-f

            delafD 1 Reply Last reply Reply Quote 0
            • delafD
              delaf @olivierlambert
              last edited by

              @olivierlambert said in REST API:

              For the last point, I invite you stay tuned being read carefully each XO release blog post. It's available in XO 5.72 since last June, see https://xen-orchestra.com/blog/xen-orchestra-5-72/#-rest-api-token-generation

              I forgot it or miss it ๐Ÿ˜ž
              Thank you!

              @olivierlambert said in REST API:

              However, there's a big gap with POST actions (doing "actions" in short). Since almost all operations are async, like disk or VM creation, REST needs to be tuned for that. I would say it's the "hard" part in REST vs a connected API like xo-cli with websockets and its persistent connection. We will probably use a "queue" system you can request to get the status of the task and the answer. Eg the UUID of the freshly created VM. All in all, it's more complex and can't be done quickly like adding "GET" actions

              I hope you will find something that it is not too complicated to implement in your side!

              @olivierlambert said in REST API:

              Finally, the permissions IMHO are even more complex, we need to discuss that with @julien-f

              Yes permissions are always a big thing.

              R 1 Reply Last reply Reply Quote 0
              • R
                r0123456789 @delaf
                last edited by

                Hello guys!

                There is a way on rest api to change vms tags?

                I tried something like this:

                curl -b authenticationToken=MYTOKEN -X POST -d "{"tags":"MYTAG"}" https://ENDPOINT/rest/v0/vms/UUID

                and i got this error:

                <pre>Cannot POST /rest/v0/vms/UUID</pre>

                Thanks!

                1 Reply Last reply Reply Quote 0
                • olivierlambertO
                  olivierlambert Vates ๐Ÿช Co-Founder๐Ÿฆธ CEO ๐Ÿง‘โ€๐Ÿ’ผ
                  last edited by

                  There's no POST possible at the moment, only GET to read what you need. However, it's planned to add actions, and tags might be one of the easiest (but before, we need to finish our new task system and create a "queue" for the REST API for all async tasks)

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO
                    olivierlambert Vates ๐Ÿช Co-Founder๐Ÿฆธ CEO ๐Ÿง‘โ€๐Ÿ’ผ
                    last edited by

                    @marcungeschikts we need to get that in the planning, at least initial POST feature before the end of Q1 ๐Ÿ™‚

                    marcungeschiktsM 1 Reply Last reply Reply Quote 0
                    • marcungeschiktsM
                      marcungeschikts Vates ๐Ÿช Project management โฑ๏ธ @olivierlambert
                      last edited by

                      @olivierlambert ๐Ÿ‘Œ

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post