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

    Creating an API for XCP-ng tasks

    Scheduled Pinned Locked Moved Development
    13 Posts 4 Posters 4.0k Views 2 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.
    • B Offline
      BeDazzleMe
      last edited by

      Hi All,

      I would like to hire a developer to help us create an interface for our customers to start/restart/shutdown their VMs running on XCP-ng.

      We've had some discussions around approaching this, but I would like to hear from others what is the best way to create an API to talk to XCP-ng from a PHP based web application.

      Happy to hear thoughts, input and advice.

      Many thanks.

      Darren.

      1 Reply Last reply Reply Quote 0
      • stormiS Offline
        stormi Vates 🪐 XCP-ng Team
        last edited by

        XCP-ng's main API is the XenAPI.

        However, have you looked at Xen Orchestra's ACLs?

        1 Reply Last reply Reply Quote 0
        • B Offline
          BeDazzleMe
          last edited by

          Hi @stormi

          Yes, I have installed and played with that and tried xo-cli, however it's just not a proper API that we can pass commands from an external application.

          Cheers

          D.

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Offline
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            Why not using XO API then? What's not covered there for what you need?

            1 Reply Last reply Reply Quote 0
            • B Offline
              BeDazzleMe
              last edited by

              Hi @olivierlambert

              I can't find any detailed documentation on how to access and use the API, i could only find the xo-cli command reference guide.

              We want to create XEN functions (start/restart/shutdown) from our web application which is PHP.

              Is there a set of docs somewhere ?

              Many thanks

              D.

              1 Reply Last reply Reply Quote 0
              • olivierlambertO Offline
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                Each feature you can access with xo-cli can be called with XO API. It's JSON-RPC, so it will be easy to call it in PHP (for example).

                1 Reply Last reply Reply Quote 0
                • B Offline
                  BeDazzleMe
                  last edited by

                  Thanks @olivierlambert

                  Is there a definitive guide for the xo-cli commands ?

                  Where can I find an example of a JSON-RPC call that we can learn from ?

                  D.

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Offline
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    Pinging @julien-f to give you a good answer 🙂

                    1 Reply Last reply Reply Quote 0
                    • julien-fJ Offline
                      julien-f Vates 🪐 Co-Founder XO Team
                      last edited by

                      @BeDazzleMe xo-cli is an advanced tool, mainly for the developers of XO, but useful for advanced users well 🙂

                      There is no guide of commands, it uses introspection to get the available commands from xo-server:

                      xo-cli --list-commands
                      

                      For more information, take a look at the documentation.

                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        BeDazzleMe
                        last edited by

                        Thanks @julien-f

                        I have played with xo-cli and have an idea on it's workings, however that's not useful for creating scripts to utilise the API.

                        I want to understand how to form an API instruction to perform a task.

                        Is there a guide to creating JSON-RPC scripts that work with XO Server?

                        D.

                        1 Reply Last reply Reply Quote 0
                        • julien-fJ Offline
                          julien-f Vates 🪐 Co-Founder XO Team
                          last edited by

                          @BeDazzleMe It's JSON-RPC 2.0 over WebSocket on the path /api.

                          You can call the method system.getMethodsInfo to see which methods are available.

                          You can use xo-lib if you want to use JavaScript.

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            BeDazzleMe
                            last edited by

                            Thanks @julien-f

                            We had a discussion with our developer on Friday and he was recommending we look at ovirt to achieve our goal here, but I am not yet convinced we need to start down that path.

                            We've run XEN/XCP in our environment since version 5, hence I am keen to continue with it as our core, however customer service is a growing issue for us as our customers are complaining about lack of self-service capability which is fair enough.

                            Thanks for your help.

                            D.

                            1 Reply Last reply Reply Quote 0
                            • olivierlambertO Offline
                              olivierlambert Vates 🪐 Co-Founder CEO
                              last edited by olivierlambert

                              oVirt is the same concept, the only diff is maybe a REST API, but otherwise it's really similar (but even a bit harder to setup).

                              Anyway, if you need assistance on API calls, let us know.

                              1 Reply Last reply Reply Quote 0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • First post
                                Last post