This is a Bash client script for accessing Kandji API service.
The script uses cURL underneath for making all REST calls.
# Make sure the script has executable rights
$ chmod u+x kandji
# Print the list of operations available on the service
$ ./kandji -h
# Print the service description
$ ./kandji --about
# Print detailed information about specific operation
$ ./kandji <operationId> -h
# Make GET request
./kandji --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
kandji -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
# Make POST request
$ echo '<body_content>' | kandji --host <hostname> --content-type json <operationId> -
# Make POST request with simple JSON content, e.g.:
# {
# "key1": "value1",
# "key2": "value2",
# "key3": 23
# }
$ echo '<body_content>' | kandji --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -
# Make POST request with form data
$ kandji --host <hostname> <operationId> key1:=value1 key2:=value2 key3:=23
# Preview the cURL command without actually executing it
$ kandji --host http://<hostname>:<port> --dry-run <operationid>
You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:
docker build -t my-rest-client .
docker run -it my-rest-client
By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.
The generated bash-completion script can be either directly loaded to the current Bash session using:
source kandji.bash-completion
Alternatively, the script can be copied to the /etc/bash-completion.d
(or on OSX with Homebrew to /usr/local/etc/bash-completion.d
):
sudo cp kandji.bash-completion /etc/bash-completion.d/kandji
On OSX you might need to install bash-completion using Homebrew:
brew install bash-completion
and add the following to the ~/.bashrc
:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
In Zsh, the generated _kandji
Zsh completion file must be copied to one of the folders under $FPATH
variable.
All URIs are relative to **
Class | Method | HTTP request | Description |
---|---|---|---|
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsCreateAdeIntegration | POST /api/v1/integrations/apple/ade/ | Create ADE integration |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsDeleteAdeIntegration | DELETE /api/v1/integrations/apple/ade/{ade_token_id} | Delete ADE integration |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsDownloadAdePublicKey | GET /api/v1/integrations/apple/ade/public_key/ | Download ADE public key |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsGetAdeDevice | GET /api/v1/integrations/apple/ade/devices/{device_id} | Get ADE device |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsGetAdeIntegration | GET /api/v1/integrations/apple/ade/{ade_token_id} | Get ADE integration |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsListAdeDevices | GET /api/v1/integrations/apple/ade/devices | List ADE devices |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsListAdeIntegrations | GET /api/v1/integrations/apple/ade | List ADE integrations |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsListDevicesAssociatedToAdeToken | GET /api/v1/integrations/apple/ade/{ade_token_id}/devices | List devices associated to ADE token |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsRenewAdeIntegration | POST /api/v1/integrations/apple/ade/{ade_token_id}/renew | Renew ADE integration |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsUpdateAdeDevice | PATCH /api/v1/integrations/apple/ade/devices/{device_id} | Update ADE device |
AutomatedDeviceEnrollmentIntegrationsApi | automatedDeviceEnrollmentIntegrationsUpdateAdeIntegration | PATCH /api/v1/integrations/apple/ade/{ade_token_id} | Update ADE integration |
BlueprintsApi | blueprintsAssignLibraryItem | POST /api/v1/blueprints/{blueprint_id}/assign-library-item | Assign Library Item |
BlueprintsApi | blueprintsCreateBlueprint | POST /api/v1/blueprints | Create Blueprint |
BlueprintsApi | blueprintsDeleteBlueprint | DELETE /api/v1/blueprints/{blueprint_id} | Delete Blueprint |
BlueprintsApi | blueprintsGetBlueprint | GET /api/v1/blueprints/{blueprint_id} | Get Blueprint |
BlueprintsApi | blueprintsGetBlueprintTemplates | GET /api/v1/blueprints/templates/ | Get Blueprint Templates |
BlueprintsApi | blueprintsGetManualEnrollmentProfile | GET /api/v1/blueprints/{blueprint_id}/ota-enrollment-profile | Get Manual Enrollment Profile |
BlueprintsApi | blueprintsListBlueprints | GET /api/v1/blueprints | List Blueprints |
BlueprintsApi | blueprintsListLibraryItems | GET /api/v1/blueprints/{blueprint_id}/list-library-items | List Library Items |
BlueprintsApi | blueprintsRemoveLibraryItem | POST /api/v1/blueprints/{blueprint_id}/remove-library-item | Remove Library Item |
BlueprintsApi | blueprintsUpdateBlueprint | PATCH /api/v1/blueprints/{blueprint_id} | Update Blueprint |
CustomAppsApi | customAppsCreateCustomApp | POST /api/v1/library/custom-apps | Create Custom App |
CustomAppsApi | customAppsDeleteCustomApp | DELETE /api/v1/library/custom-apps/{library_item_id} | Delete Custom App |
CustomAppsApi | customAppsGetCustomApp | GET /api/v1/library/custom-apps/{library_item_id} | Get Custom App |
CustomAppsApi | customAppsListCustomApps | GET /api/v1/library/custom-apps | List Custom Apps |
CustomAppsApi | customAppsUpdateCustomApp | PATCH /api/v1/library/custom-apps/{library_item_id} | Update Custom App |
CustomAppsApi | customAppsUploadCustomApp | POST /api/v1/library/custom-apps/upload | Upload Custom App |
CustomProfilesApi | customProfilesCreateCustomProfile | POST /api/v1/library/custom-profiles | Create Custom Profile |
CustomProfilesApi | customProfilesDeleteCustomProfile | DELETE /api/v1/library/custom-profiles/{library_item_id} | Delete Custom Profile |
CustomProfilesApi | customProfilesGetCustomProfile | GET /api/v1/library/custom-profiles/{library_item_id} | Get Custom Profile |
CustomProfilesApi | customProfilesListCustomProfiles | GET /api/v1/library/custom-profiles | List Custom Profiles |
CustomProfilesApi | customProfilesUpdateCustomProfile | PATCH /api/v1/library/custom-profiles/{library_item_id} | Update Custom Profile |
CustomScriptsApi | customScriptsCreateCustomScript | POST /api/v1/library/custom-scripts | Create Custom Script |
CustomScriptsApi | customScriptsDeleteCustomScript | DELETE /api/v1/library/custom-scripts/{library_item_id} | Delete Custom Script |
CustomScriptsApi | customScriptsGetCustomScript | GET /api/v1/library/custom-scripts/{library_item_id} | Get Custom Script |
CustomScriptsApi | customScriptsListCustomScripts | GET /api/v1/library/custom-scripts | List Custom Scripts |
CustomScriptsApi | customScriptsUpdateCustomScript | PATCH /api/v1/library/custom-scripts/{library_item_id} | Update Custom Script |
DeviceActionsApi | deviceActionsClearPasscode | POST /api/v1/devices/{device_id}/action/clearpasscode | Clear Passcode |
DeviceActionsApi | deviceActionsDeleteDevice | DELETE /api/v1/devices/{device_id} | Delete Device |
DeviceActionsApi | deviceActionsDeleteUser | POST /api/v1/devices/{device_id}/action/deleteuser | Delete User |
DeviceActionsApi | deviceActionsEraseDevice | POST /api/v1/devices/{device_id}/action/erase | Erase Device |
DeviceActionsApi | deviceActionsGetDeviceCommands | GET /api/v1/devices/{device_id}/commands | Get Device Commands |
DeviceActionsApi | deviceActionsLockDevice | POST /api/v1/devices/{device_id}/action/lock | Lock Device |
DeviceActionsApi | deviceActionsReinstallAgent | POST /api/v1/devices/{device_id}/action/reinstallagent | Reinstall Agent |
DeviceActionsApi | deviceActionsRemoteDesktop | POST /api/v1/devices/{device_id}/action/remotedesktop | Remote Desktop |
DeviceActionsApi | deviceActionsRenewMdmProfile | POST /api/v1/devices/{device_id}/action/renewmdmprofile | Renew MDM Profile |
DeviceActionsApi | deviceActionsRestartDevice | POST /api/v1/devices/{device_id}/action/restart | Restart Device |
DeviceActionsApi | deviceActionsSendBlankpush | POST /api/v1/devices/{device_id}/action/blankpush | Send Blankpush |
DeviceActionsApi | deviceActionsSetName | POST /api/v1/devices/{device_id}/action/setname | Set Name |
DeviceActionsApi | deviceActionsShutdown | POST /api/v1/devices/{device_id}/action/shutdown | Shutdown |
DeviceActionsApi | deviceActionsUnlockAccount | POST /api/v1/devices/{device_id}/action/unlockaccount | Unlock Account |
DeviceActionsApi | deviceActionsUpdateInventory | POST /api/v1/devices/{device_id}/action/updateinventory | Update Inventory |
DeviceInformationApi | deviceInformationCancelLostMode | DELETE /api/v1/devices/{device_id}/details/lostmode | Cancel Lost Mode |
DeviceInformationApi | deviceInformationGetDeviceActivity | GET /api/v1/devices/{device_id}/activity | Get Device Activity |
DeviceInformationApi | deviceInformationGetDeviceApps | GET /api/v1/devices/{device_id}/apps | Get Device Apps |
DeviceInformationApi | deviceInformationGetDeviceDetails | GET /api/v1/devices/{device_id}/details | Get Device Details |
DeviceInformationApi | deviceInformationGetDeviceLibraryItems | GET /api/v1/devices/{device_id}/library-items | Get Device Library Items |
DeviceInformationApi | deviceInformationGetDeviceLostModeDetails | GET /api/v1/devices/{device_id}/details/lostmode | Get Device Lost Mode details |
DeviceInformationApi | deviceInformationGetDeviceParameters | GET /api/v1/devices/{device_id}/parameters | Get Device Parameters |
DeviceInformationApi | deviceInformationGetDeviceStatus | GET /api/v1/devices/{device_id}/status | Get Device Status |
DeviceInformationApi | deviceInformationListDevices | GET /api/v1/devices | List Devices |
DeviceSecretsApi | deviceSecretsGetActivationLockBypassCode | GET /api/v1/devices/{device_id}/secrets/bypasscode | Get Activation Lock Bypass Code |
DeviceSecretsApi | deviceSecretsGetFilevaultRecoveryKey | GET /api/v1/devices/{device_id}/secrets/filevaultkey | Get FileVault Recovery Key |
DeviceSecretsApi | deviceSecretsGetRecoveryLockPassword | GET /api/v1/devices/{device_id}/secrets/recoverypassword | Get Recovery Lock Password |
DeviceSecretsApi | deviceSecretsGetUnlockPin | GET /api/v1/devices/{device_id}/secrets/unlockpin | Get Unlock Pin |
InHouseAppsApi | inhouseAppsCreateInhouseApp | POST /api/v1/library/ipa-apps | Create In-House App |
InHouseAppsApi | inhouseAppsDeleteInhouseApp | DELETE /api/v1/library/ipa-apps/{library_item_id} | Delete In-House App |
InHouseAppsApi | inhouseAppsGetInhouseApp | GET /api/v1/library/ipa-apps/{library_item_id} | Get In-House App |
InHouseAppsApi | inhouseAppsListInhouseApps | GET /api/v1/library/ipa-apps | List In-House Apps |
InHouseAppsApi | inhouseAppsUpdateInhouseApp | PATCH /api/v1/library/ipa-apps/{library_item_id} | Update In-House App |
InHouseAppsApi | inhouseAppsUploadInhouseApp | POST /api/v1/library/ipa-apps/upload | Upload In-House App |
InHouseAppsApi | inhouseAppsUploadInhouseAppStatus | GET /api/v1/library/ipa-apps/upload/{pending_upload_id}/status | Upload In-House App Status |
LibraryItemsApi | libraryItemsGetLibraryItemActivity | GET /api/v1/library/library-items/{library_item_id}/activity | Get Library Item Activity |
LibraryItemsApi | libraryItemsGetLibraryItemStatuses | GET /api/v1/library/library-items/{library_item_id}/status | Get Library Item Statuses |
LostModeApi | lostModeDisableLostMode | POST /api/v1/devices/{device_id}/action/disablelostmode | Disable Lost Mode |
LostModeApi | lostModeEnableLostMode | POST /api/v1/devices/{device_id}/action/enablelostmode | Enable Lost Mode |
LostModeApi | lostModePlayLostModeSound | POST /api/v1/devices/{device_id}/action/playlostmodesound | Play Lost Mode Sound |
LostModeApi | lostModeUpdateLocation | POST /api/v1/devices/{device_id}/action/updatelocation | Update Location |
NotesApi | notesCreateDeviceNote | POST /api/v1/devices/{device_id}/notes | Create Device Note |
NotesApi | notesDeleteDeviceNote | DELETE /api/v1/devices/{device_id}/notes/{note_id} | Delete Device Note |
NotesApi | notesGetDeviceNotes | GET /api/v1/devices/{device_id}/notes | Get Device Notes |
NotesApi | notesRetrieveDeviceNote | GET /api/v1/devices/{device_id}/notes/{note_id} | Retrieve Device Note |
NotesApi | notesUpdateDeviceNote | PATCH /api/v1/devices/{device_id}/notes/{note_id} | Update Device Note |
PrismApi | prismActivationLock | GET /api/v1/prism/activation_lock | Activation lock |
PrismApi | prismApplicationFirewall | GET /api/v1/prism/application_firewall | Application firewall |
PrismApi | prismApplications | GET /api/v1/prism/apps | Applications |
PrismApi | prismCertificates | GET /api/v1/prism/certificates | Certificates |
PrismApi | prismCount | GET /api/v1/prism/count | Count |
PrismApi | prismDesktopAndScreensaver | GET /api/v1/prism/desktop_and_screensaver | Desktop and Screensaver |
PrismApi | prismDeviceInformation | GET /api/v1/prism/device_information | Device information |
PrismApi | prismFilevault | GET /api/v1/prism/filevault | FileVault |
PrismApi | prismGatekeeperAndXprotect | GET /api/v1/prism/gatekeeper_and_xprotect | Gatekeeper and XProtect |
PrismApi | prismGetCategoryExport | GET /api/v1/prism/export/{export_id} | Get category export |
PrismApi | prismInstalledProfiles | GET /api/v1/prism/installed_profiles | Installed profiles |
PrismApi | prismKernelExtensions | GET /api/v1/prism/kernel_extensions | Kernel Extensions |
PrismApi | prismLaunchAgentsAndDaemons | GET /api/v1/prism/launch_agents_and_daemons | Launch Agents and Daemons |
PrismApi | prismLocalUsers | GET /api/v1/prism/local_users | Local users |
PrismApi | prismRequestCategoryExport | POST /api/v1/prism/export | Request category export |
PrismApi | prismStartupSettings | GET /api/v1/prism/startup_settings | Startup settings |
PrismApi | prismSystemExtensions | GET /api/v1/prism/system_extensions | System Extensions |
PrismApi | prismTransparencyDatabase | GET /api/v1/prism/transparency_database | Transparency database |
SelfServiceApi | selfServiceListSelfServiceCategories | GET /api/v1/self-service/categories | List Self Service Categories |
SettingsApi | settingsLicensing | GET /api/v1/settings/licensing | Licensing |
TagsApi | tagsCreateTag | POST /api/v1/tags | Create Tag |
TagsApi | tagsDeleteTag | DELETE /api/v1/tags/{tag_id} | Delete Tag |
TagsApi | tagsGetTags | GET /api/v1/tags | Get Tags |
TagsApi | tagsUpdateTag | PATCH /api/v1/tags/{tag_id} | Update Tag |
ThreatsApi | threatsGetThreatDetails | GET /api/v1/threat-details | Get Threat Details |
UsersApi | usersDeleteUser | DELETE /api/v1/users/{user_id} | Delete User |
UsersApi | usersGetUser | GET /api/v1/users/{user_id} | Get User |
UsersApi | usersListUsers | GET /api/v1/users | List Users |
- Type: HTTP Bearer Token authentication (API Token)