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

    XO Rest API

    Scheduled Pinned Locked Moved REST API
    28 Posts 5 Posters 1.2k Views 5 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 Online
      olivierlambert Vates 🪐 Co-Founder CEO
      last edited by

      Great 🙂 For the version from the sources, it doesn't matter that you have paid support or not: you must use it with latest commits as possible 🙂 For XOA, then it's up to the support to answer you 🙂

      I 1 Reply Last reply Reply Quote 0
      • I Offline
        irtaza9 @olivierlambert
        last edited by

        @olivierlambert omg 😵 I'll upgrade the XO. My question is still same, why the rest-api is not responding properly when I hit it from postman and the same api is responding with error when using xo-cli 😊

        1 Reply Last reply Reply Quote 0
        • D Offline
          df-cgdm
          last edited by

          It looks like that's not possible to specify the CPU ??! with the /rest/v0/pools/{{pool_id}}/actions/create_vm

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

            What do you mean by "specify the CPU"?

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              df-cgdm @olivierlambert
              last edited by

              @olivierlambert I'm not able to specify the number of vCPU for the VM

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

                Are you fully up to date? Also pinging @julien-f about this.

                D 1 Reply Last reply Reply Quote 0
                • D Offline
                  df-cgdm @olivierlambert
                  last edited by

                  @olivierlambert yes I think so.

                  XOA.jpg

                  Here is the result of /rest/v0/pools/_/actions/create_vm (there is no cpu parameter)

                  {
                    "params": {
                      "affinity": {
                        "type": "string",
                        "optional": true
                      },
                      "auto_poweron": {
                        "type": "boolean",
                        "optional": true
                      },
                      "boot": {
                        "type": "boolean",
                        "default": false
                      },
                      "clone": {
                        "type": "boolean",
                        "default": true
                      },
                      "cloud_config": {
                        "type": "string",
                        "optional": true
                      },
                      "destroy_cloud_config_vdi": {
                        "type": "boolean",
                        "default": false
                      },
                      "install": {
                        "type": "object",
                        "optional": true,
                        "properties": {
                          "method": {
                            "enum": [
                              "cdrom",
                              "network"
                            ]
                          },
                          "repository": {
                            "type": "string"
                          }
                        }
                      },
                      "memory": {
                        "type": "integer",
                        "optional": true
                      },
                      "name_description": {
                        "type": "string",
                        "minLength": 0,
                        "optional": true
                      },
                      "name_label": {
                        "type": "string"
                      },
                      "network_config": {
                        "type": "string",
                        "optional": true
                      },
                      "template": {
                        "type": "string"
                      },
                      "vdis": {
                        "type": "array",
                        "default": [],
                        "items": {
                          "type": "object",
                          "properties": {
                            "destroy": {
                              "type": "boolean",
                              "optional": true
                            },
                            "userdevice": {
                              "type": "string",
                              "optional": true
                            },
                            "size": {
                              "type": "number",
                              "optional": true
                            },
                            "sr": {
                              "type": "string",
                              "optional": true
                            },
                            "name_description": {
                              "type": "string",
                              "optional": true
                            },
                            "name_label": {
                              "type": "string",
                              "optional": true
                            }
                          },
                          "if": {
                            "not": {
                              "required": [
                                "userdevice"
                              ]
                            }
                          },
                          "then": {
                            "required": [
                              "size",
                              "name_label"
                            ],
                            "not": {
                              "required": [
                                "destroy"
                              ]
                            }
                          }
                        }
                      },
                      "vifs": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "destroy": {
                              "type": "boolean",
                              "optional": true
                            },
                            "device": {
                              "type": "string",
                              "optional": true
                            },
                            "ipv4_allowed": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "optional": true
                            },
                            "ipv6_allowed": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "optional": true
                            },
                            "mac": {
                              "type": "string",
                              "optional": true
                            },
                            "network": {
                              "type": "string",
                              "optional": true
                            }
                          }
                        }
                      }
                    }
                  }
                  
                  DanpD 1 Reply Last reply Reply Quote 0
                  • DanpD Offline
                    Danp Pro Support Team @df-cgdm
                    last edited by

                    @df-cgdm You are correct. That feature isn't currently available via the REST APIs as previously mentioned by Julien earlier in this thread.

                    I 1 Reply Last reply Reply Quote 1
                    • I Offline
                      irtaza9 @Danp
                      last edited by

                      @Danp For now I'm going with JSON-RPC for only VM creation and for listings I'm using rest-apis. When XO6 will release I'll change the endpoint with rest endpoint. @olivierlambert any expected release date for XO6?

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

                        It's rolled out progressively: every bit of UI that's exposed will use the REST API, so both a getting more stuff every release. You can already use some bits of the REST API like you can already use XO 6 UI with /v6

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

                          Yes, you can use JSON-RPC et REST APIs together for now 🙂

                          We will try to add support for CPU settings soon.

                          Also, expect things to accelerate in 2025 regarding the REST API.

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