Hello
I run into trouble with creating a new jail through API.
What do I have//What I can do:
- FreeBSD 13.1-RELEASE-p2 n245412-484f039b1d0 TRUENAS
- I can start or stop jail.
What did I checked:
1)
I looked into this API doc https://www.truenas.com/docs/api/rest.html
Example is "empty" as for me, and understand what should be in body is not possible:
But if run this request I response
At the end of tries, I discovered that to get 200OK need only two parameters
But this didn't worked out
2)
I checked API doc directly on my own TrueNAS Core Instance by url http://my.truenas.local/api/docs/
Here I found Example values, and used such values(below). In response I getting 200 OK and some random number, but I do not see any new jail in jails
Question:
- How do a correct request to create a jail?
Thank you
I run into trouble with creating a new jail through API.
What do I have//What I can do:
- FreeBSD 13.1-RELEASE-p2 n245412-484f039b1d0 TRUENAS
- I can start or stop jail.
What did I checked:
1)
I looked into this API doc https://www.truenas.com/docs/api/rest.html
Example is "empty" as for me, and understand what should be in body is not possible:
Code:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic [[basicHash]]" "http://realmini.tn.ixsystems.com/api/v2.0/jail"
But if run this request I response
Code:
{ "message": "create() missing 1 required positional argument: 'data'", "traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/middlewared/restful.py\", line 575, in do\n result = await self.middleware.call(methodname, *method_args, **method_kwargs)\n File \"/usr/local/lib/python3.9/site-packages/middlewared/main.py\", line 1278, in call\n return await self._call(\n File \"/usr/local/lib/python3.9/site-packages/middlewared/main.py\", line 1235, in _call\n return await methodobj(*prepared_call.args)\nTypeError: create() missing 1 required positional argument: 'data'\n"
At the end of tries, I discovered that to get 200OK need only two parameters
Code:
{"data":"asd", "uuid":"asd"}
But this didn't worked out
2)
I checked API doc directly on my own TrueNAS Core Instance by url http://my.truenas.local/api/docs/
Here I found Example values, and used such values(below). In response I getting 200 OK and some random number, but I do not see any new jail in jails
Code:
curl -X 'POST' 'http://my.truenas.local/api/v2.0/jail' -H 'accept: */*' -H 'Authorization: Bearer 1-xxx' -H 'Content-Type: application/json' -d '{ "release": "13.1-RELEASE-p7", "template": "0", "pkglist": [ "nginx" ], "uuid": "test-3", "basejail": true, "empty": true, "short": true, "props": [ null ], "https": true }'
Question:
- How do a correct request to create a jail?
Thank you