RESTful API 2.0 bug with /disk/id/{id}

Description

As discussed in this forum thread there is an Issue with the

RESTful API 2.0 call, because disks don’t have a numeric ID assigned to them. To fix this, the config database scheme would need to be changed to include a numeric ID or the RESTful API wrapper would need to accept “string” typed IDs, too, either via GET/POST body or as URI component, but the latter would mean that the current “identifier” values need to be URLencoded before putting them in the URI because of special chars…

If one isn’t limited to RESTful API 2.0, there are workarounds like using ‘midclt’ to call the needed method as described in the forum post. But you either need shell access or use websocket API to use the workaround, which might not be feasible for everyone.

Here is what currently happens when I try to GET disk id 0:

As you can see, there is no ‘id’ listed when querying a disk:

This issue exists at least since Version 11.3-U3.1 and since in 13.0-U4 it’s still the same, I guess that the bug is in all releases inbetween those two.

Problem/Justification

None

Impact

None

Activity

Show:

Automation for Jira June 20, 2023 at 8:25 AM

This issue has now been closed. Comments made after this point may not be viewed by the TrueNAS Teams. Please open a new issue if you have found a problem or need to re-engage with the TrueNAS Engineering Teams.

Bug Clerk June 20, 2023 at 7:25 AM

Vladimir Vinogradenko June 20, 2023 at 7:23 AM

Non-numeric identifiers work for me on 23.10

Christian Marg June 13, 2023 at 8:27 AM
Edited

Yes, I tried that to no avail via URLencode and GET-Body - the RESTful API 2.0 wrapper expects an integer value, `identifier` is a string…
See also the Post of the Forum Moderator Samuel Tai: :

Yes, this is a bug in the RESTful 2.0 API. The API call works correctly using midclt call disk.update '{serial_lunid}P4HEY9UC_5000cca249d46e61' '{"smartoptions":"-d sat"}'. The basic issue is the dictionary for the storage_disk table in the configuration database doesn't have a field corresponding to id.

William Gryzbowski June 12, 2023 at 6:04 PM

Did you try using “identifier" ?

Complete
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Impact

Medium

Time remaining

0m

Components

Affects versions

Priority

Katalon Platform

Created June 1, 2023 at 9:45 AM
Updated August 11, 2023 at 9:46 AM
Resolved June 20, 2023 at 8:25 AM