Skip to content

Commit 2aecdb1

Browse files
committed
docs: correct four statements checked against the client
- results: on a failed call getData() is null only when there is no JSON answer; when Proxmox VE answers with an error it is an empty node. - tasks: same wording for the UPID of a failed call; the interval and the time of waitForTaskToFinish have a lower limit. - API structure: required parameters are int and boolean, the optional ones Integer and Boolean.
1 parent 429c2e5 commit 2aecdb1

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎docs/src/content/docs/concepts/api-structure.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ snapshot = vm.getSnapshot().snapshot("before-update", null, true);
7878
```
7979

8080
- Names are those of the API. A `-` in a name becomes `_`: `force-cpu` is `force_cpu`.
81-
- Booleans are `Boolean` and are sent as `1` or `0`.
81+
- Required parameters have primitive types (`int`, `boolean`), the optional ones the wrapper types
82+
(`Integer`, `Boolean`), so that they can be `null`. Booleans are sent as `1` or `0`.
8283
- Parameters that exist with an index (`net0`, `net1`, `scsi0`) are one `Map<Integer, String>`
8384
argument, `netN`, `scsiN`: see [Indexed parameters](/cv4pve-api-java/concepts/indexed-parameters/).
8485
- Type, format and allowed values of each parameter are in the API viewer; the client sends what you

‎docs/src/content/docs/concepts/results.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ var upid = client.getNodes().get("pve01").getQemu().get(100).getStatus().getStar
6060
<Aside type="caution">
6161
`get("name")` returns `null` for a member that Proxmox VE leaves out, and many are optional: for
6262
example `name`, `cores` and `description` in the configuration of a VM, which are not returned when
63-
they have no value or the default one. On a failed call `getData()` itself is `null`. Check
64-
`isSuccessStatusCode()` first, and read optional members with `path`.
63+
they have no value or the default one. On a failed call there is no data: `getData()` is `null` when
64+
the request got no JSON answer, and an empty node, whose `get("name")` returns `null`, when Proxmox VE
65+
answered with an error. Check `isSuccessStatusCode()` first, and read optional members with `path`.
6566
</Aside>
6667

6768
### Optional members

‎docs/src/content/docs/concepts/tasks.mdx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ var finished = client.waitForTaskToFinish(upid, 2000, 600000);
3737

3838
It reads the status of the task at each interval until the task stops, and returns `true` if it
3939
stopped, `false` if it is still running when the time runs out. Set the time to the longest the task
40-
may take: seconds for a start or a snapshot, minutes for a clone, a migration or a backup.
40+
may take: seconds for a start or a snapshot, minutes for a clone, a migration or a backup. An interval
41+
of 0 or less becomes 500 milliseconds, and a time shorter than the interval becomes the interval plus
42+
5 seconds.
4143

4244
<Aside type="caution">
4345
Check `isSuccessStatusCode()` of the call before reading the UPID, as above: a call that failed has
44-
no task, and `getData()` is `null`.
46+
no task, and no data to read the UPID from.
4547
</Aside>
4648

4749
To check without waiting, `taskIsRunning(upid)` returns `true` while the task runs.

0 commit comments

Comments
 (0)