TheJumpCloud / jcapi-python

21 stars 20 forks source link

Missing documentation on running commands #47

Open h-betz opened 4 years ago

h-betz commented 4 years ago

There appears to be a lack of information regarding how to run a command on your documentation https://docs.jumpcloud.com/1.0/commands/QhvaHddE3MvJpE55i

I presume you need to specify the command ID though I tried passing it in through the URL and through the POST data with no success. This doesn't appear to be a feature in V2 of the API https://docs.jumpcloud.com/2.0/commands.

What I'm trying to do is, given a specific command ID, I want to run that command.

kkirklandjc commented 4 years ago

Hi Hunter,

Kyle here from the JumpCloud Support team. Hopefully I can provide clarification for a sample command for the /runCommand/ endpoint in the v1 api.

In the initial GET request from https://console.jumpcloud.com/api/commands/ \, you'll be sent several data values for your organization's commands. All of these data values need to be present in your next request for the /runCommand/ endpoint. Below is a sample request. Of course, you'll need to plug in your data values from your /commands/ result into the following request:

curl -X POST https://console.jumpcloud.com/api/runCommand/ \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: api_key' \
  -d '{
    "objectId": "command ID",
    "name": "command name",
    "command": "command input values",
    "commandType": "os",
    "launchType": "manual/scheduled/repeating/etc",
    "listensTo": "",
    "schedule": "",
    "trigger": "",
    "scheduleRepeatType": "",
    "organization": "orgid",
    "_id": "command id"
}'

A valid response will contain a blank value (not great - we're aware) or a "queueId" value, indicating a successful request.

Please respond to this thread if you have any questions!

h-betz commented 4 years ago

Great, thank you!