Trouble with REST API /pool/dataset/id/ PUT request

user0241233

Dabbler
Joined
Oct 19, 2022
Messages
15
Hello,

I'm trying to use REST API endpoint /pool/dataset/id/ PUT to modify a dataset that I created. Specifically, I'd like to change the name of the dataset. This is what I have been able to achieve so far,

Code:
curl --location --request PUT 'http://abc.com/api/v2.0/pool/dataset/id/StoragePool%2Fdata-test%2Fgroups%2Fhardware' \
--header 'Authorization: Basic ######' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "StoragePool/data-test/groups/software"
}'


But I'm getting a weird output.
Code:
{
    "pool_dataset_update.name": [
        {
            "message": "Field was not expected",
            "errno": 22
        }
    ]
}


When I try changing something else, like the "quota",

Code:
curl --location --request PUT 'http:////abc.com/api/v2.0/pool/dataset/id/StoragePool%2Fdata-test%2Fgroups%2Fhardware' \
--header 'Authorization: Basic ######' \
--header 'Content-Type: application/json' \
--data-raw '{
    "quota": 2000000000
}'


I get the following error:

Code:
500 Internal Server Error

Server got itself in trouble


TrueNAS Scale Version: TrueNAS-SCALE-22.02.4
Let me know if you need further info and please help with this,

Thanks,
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
have you tried via webUI or CLI?
They would both use the same API.
 

user0241233

Dabbler
Joined
Oct 19, 2022
Messages
15
have you tried via webUI or CLI?
They would both use the same API.
@morganL I can use the webUI for most cases (webUI doesn't allow changing the dataset name, which I need to do) but CLI works just fine. But I need to automate creation of several datasets and need the API for that. Do you think it could be a bug? Should I create a bug report?
 
Last edited:

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
@morganL I can use the webUI for most cases (webUI doesn't allow changing the dataset name, which I need to do) but CLI works just fine. But I need to automate creation of several datasets and need the API for that. Do you think it could be a bug? Should I create a bug report?
If TrueNAS CLI (not linux CLI) works....its probably not a bug, but a configuration issue.

If you can confirm that other apis work and a specific one doesn't, its probably a bug and should be reported.

Lets see if anyone else can spot an issue.
 

user0241233

Dabbler
Joined
Oct 19, 2022
Messages
15
If TrueNAS CLI (not linux CLI) works....its probably not a bug, but a configuration issue.
@morganL I'm afraid I'm not sure which is which. I'm only aware of one CLI which is accessed through webUI through System Settings > Shell and I've always assumed it to be TrueNAS CLI.

If you can confirm that other apis work and a specific one doesn't, its probably a bug and should be reported.
Yes, I've used other endpoints and I've been able to use them. The same endpoint that I have mentioned to be causing issue (PUT /pool/dataset/id/{id}) works just fine with GET method but doesn't work with PUT.
 
Top