Navigation

    XCP-ng

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Creating an API for XCP-ng tasks

    Development
    4
    13
    229
    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.
    • stormi
      stormi XCP-ng Team Admin Vates 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
        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
        • olivierlambert
          olivierlambert XCP-ng Team Admin Vates Team 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
            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
            • olivierlambert
              olivierlambert XCP-ng Team Admin Vates Team 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
                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
                • olivierlambert
                  olivierlambert XCP-ng Team Admin Vates Team last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • julien-f
                    julien-f XO Team Admin Vates 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
                      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-f
                        julien-f XO Team Admin Vates 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
                          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
                          • olivierlambert
                            olivierlambert XCP-ng Team Admin Vates Team 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
                            • First post
                              Last post
                            XCP-ng Pro Support

                            XCP-ng Pro Support