@Tom-Elliott can you get me curl command or minimal list json params to create image in fog ?
Thanks
Posts made by mnsk
-
RE: Create host by API (curl)
-
RE: Create host by API (curl)
@tom-elliott, thanks for your support ! Greate product !
-
RE: Create host by API (curl)
@tom-elliott when i change mac address curl can create host, but before i cant get any error about used mac, if json retern this error i can resolved problem)
-
RE: Create host by API (curl)
Yep, I found problem.
For example I use mac address, it already will be add to fog system.
Details i found in /var/log/apache2/error.log[Sun Jul 25 17:09:10.163987 2021] [proxy_fcgi:error] [pid 17738] [client 192.168.100.59:44634] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Exception: MAC address is already in use by another host: ship2-arm2-m121 in /var/www/fog/lib/fog/host.class.php:1696\nStack trace:\n#0 /var/www/fog/lib/router/route.class.php(928): Host->addPriMAC(Object(MACAddress))\n#1 /var/www/fog/lib/router/route.class.php(342): Route::create(Object(Host), 'POST')\n#2 /var/www/fog/lib/router/route.class.php(222): Route::runMatches()\n#3 /var/www/fog/api/index.php(23): Route->__construct()\n#4 {main}\n thrown in /var/www/fog/lib/fog/host.class.php on line 1696'
Some error message from web-server can be usefull, what u think ? @Tom-Elliott
-
RE: Create host by API (curl)
kaisinav@kubuntu-vm:~/fog_auto$ curl --max-time 30 \ -H "fog-api-token: $FOG_API_TOKEN" \ -H "fog-user-token: $FOG_USER_API_TOKEN" \ -H "Content-Type: application/json" \ -X POST \ -d {"name":"testing", "macs":["2c:94:64:01:70:f4"], "imageID": 3}\ http://$FOG_SERVER/fog/host/create curl: (3) bad range in URL position 7: macs:[2c:94:64:01:70:f4],
Hmm, something going wrong
with double quotes
kaisinav@kubuntu-vm:~/fog_auto$ curl --max-time 30 -H "fog-api-token: $FOG_API_TOKEN" -H "fog-user-token: $FOG_USER_API_TOKEN" -H "Content-Type: application/json" -X POST -d "{"name":"testing", "macs":["2c:94:64:01:70:f4"]}" http://$FOG_SERVER/fog/host/create { "error": "Required database field is empty"
with single quotes, empty respones
curl --max-time 30 -H "fog-api-token: $FOG_API_TOKEN" -H "fog-user-token: $FOG_USER_API_TOKEN" -H "Content-Type: application/json" -X POST -d '{"name":"testing", "macs":["2c:94:64:01:70:f4"]}' http://$FOG_SERVER/fog/host/create
-
RE: Create host by API (curl)
@tom-elliott
STDOUT and STDERR empty, all variable export in bash script.
After randomly change (json body) in curl command, host add in mysql base but dont visable in web-interface.
Can you get right json body with requirement params, to add host. -
Create host by API (curl)
Hello, try to create host by curl.
curl --max-time 30 -H "fog-api-token: $FOG_API_TOKEN" -H "fog-user-token: $FOG_USER_API_TOKEN" -H "Content-Type: application/json" -X POST -d '{"name":"testing", "macs":"2c:94:64:01:70:f4", "imagename":"astra-1.6-gui-leg-basic-conf", "imageID":3}' http://$FOG_SERVER/fog/host/create
Where my mistake? Where i can read full API DOC with body request and depency?