Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$post and $put request send data as querystrings #10

Closed
timcole opened this issue Aug 16, 2022 · 4 comments
Closed

$post and $put request send data as querystrings #10

timcole opened this issue Aug 16, 2022 · 4 comments

Comments

@timcole
Copy link

timcole commented Aug 16, 2022

Mutation requests $post, $put send query strings for data instead of using the body.

Something went wrong Error: post https://{REDACTED}:8006/api2/json/nodes/ceres/qemu/901/clone?full=1&name=26d534a50eb5&newid=105 return Error 400 Parameter verification failed.: {"data":null,"errors":{"newid":"property is missing and it is not optional"}}
    at ProxmoxEngine.doRequest (/app/node_modules/proxmox-api/dist/ProxmoxEngine.js:159:23)
const newid = await ctx.proxmox.cluster.nextid.$get();
const vm = await ctx.proxmox.nodes
  .$(node!)
  .qemu.$(template.vmid)
  .clone.$post({
    full: true,
    name: `${randomBytes(6).toString('hex')}`,
    newid,
  });
@UrielCh
Copy link
Owner

UrielCh commented Aug 17, 2022

add a console.log(newid) for me it do not contains a number.
... newid=105 oups it looks ok.
I will check that later.

did it work with the previous version?

@timcole
Copy link
Author

timcole commented Aug 18, 2022

Just downgraded again and it's broke in 0.2.0 as well 😭

@UrielCh
Copy link
Owner

UrielCh commented Aug 18, 2022

in one of my scripts I use this code:

          console.log(`Using template ${template.vmid} (${template.name})`);
          console.log(`build VM: ${id} on ${server.hostname}`);
          const newid = 1000 + id;
          await server.destroyVM(newid)

          // const newid = 1000 + id;
          console.log(`creating VM: ${newid}`);
          await api.nodes
            .$(server.node)
            .qemu.$(template.vmid)
            .clone.$post({ newid, name: `vm-${serverName}-${id}` });

and it used to work.

It may work only with Proxmox 6, Can not with Proxmox 7.
I publish a 0.3.2, which may fix this issue, but I can not test it right now.

@timcole
Copy link
Author

timcole commented Aug 18, 2022

Maybe Proxmox 6 supported sending query params? We are using Proxmox 7 so can't check but I think that's likely.

Can't test the new update in our same codebase because we swapped out for an own in-house solution yesterday (too many bugs and licensing issues for our liking with this lib) but created a sample script just to test the update for you and seems to be fixed now.

Thanks for the resolution and best of luck on the project!

@timcole timcole closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants