Need a FOG API Call that works
-
I am trying to work through the Simplified API Documentation and have successfully implemented some GET calls to do things like ‘get all hosts’, ‘get active tasks’, etc…
However, the last code snippet in the doc is for queuing a Task for Host #1 but ALL I get back is:{ "error": "Invalid tasking type passed" }
I have tried many different taskTypeID’s and always get the same result.
I am running the curl command from a Linux terminal and also have converted it to an HTTP POST Request in PostMan… but nothing works!Does anyone have a working curl or http request to queue a Deploy Task for a specific host?
Oh yeah, this is on FOG 1.5.7
Thanks everyone! -
@jcargile You might have shared the curl call you were using to see where the issue lies. Here is a working curl call to create a task that I just tested (pretty much derived from the Simplified API Documentation:
curl --silent -k -H 'content-type: application/json' -H 'fog-user-token: UsErToKeN' -H 'fog-api-token: aPiToKeN' -X POST -d '{"taskTypeID":2,"shutdown": true}' http://fogserver/fog/host/1/task
This means schedule an upload/capture task (ID 2) for my host #1.
Search the forum for “fog-api-token” and you’ll find even more examples.
-
You might want to check out these threads to see if there are any clues. TBH I’m not a programmer so you may have already found these
https://forums.fogproject.org/topic/10036/api/4
https://forums.fogproject.org/topic/12026/powershell-api-module/8
-
@jcargile You might have shared the curl call you were using to see where the issue lies. Here is a working curl call to create a task that I just tested (pretty much derived from the Simplified API Documentation:
curl --silent -k -H 'content-type: application/json' -H 'fog-user-token: UsErToKeN' -H 'fog-api-token: aPiToKeN' -X POST -d '{"taskTypeID":2,"shutdown": true}' http://fogserver/fog/host/1/task
This means schedule an upload/capture task (ID 2) for my host #1.
Search the forum for “fog-api-token” and you’ll find even more examples.
-
@Sebastian-Roth
I have no idea what I was doing wrong here… My calls now work.