Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/jamf_school/models/mod.ts>API

A simple, secure, correct, and modern Jamf School API wrapper. (Unofficial)
Latest
interface API
import { type API } from "https://deno.land/x/jamf_school@0.5.0/models/mod.ts";

API is a low-level wrapper over the Jamf School API. It serves as a replacement to manually making requests. It performs data validation and error handling. Network errors, validation errors, and permission errors will all be raised.

Unfortunately, the data returned by these methods cannot be explored through doc.deno.land due to limitations with the documentation generator, as it would require a full TypeScript implementation to evaluate the types. Instead, the best solution is to either use the deno language server, or find the RouteData parameter in the method you want and find the matching file in https://deno.land/x/jamf_school/schemas.

Properties

readonly
type: "API"

Discriminator for type checks.

readonly
url: string

The URL that this API object will use as a base.

Methods

getDevice(udid: string, options?: APIGetDeviceOptions): Promise<RouteData<"GET /devices/:udid">["device"]>

(Read) Get a single device by its UDID.

getDevices(options?: APIGetDevicesOptions): Promise<RouteData<"GET /devices">["devices"]>

(Read) Get all devices.

setDeviceOwner(udid: string, userId: number): Promise<RouteData<"PUT /devices/:udid/owner">>

(Edit) Assign a new owner to a device. Using ID 0 will remove the owner without setting a new one.

moveDevice(
udid: string,
locationId: number,
): Promise<RouteData<"PUT /devices/:udid/migrate">>

(Edit) Move the device and its owner to a new location.

The device owner will also be moved if onlyDevice is not true.

moveDevices(
devices: string[],
locationId: number,
): Promise<RouteData<"PUT /devices/migrate">>

(Edit) Move a collection of devices to a new location.

The device owners and any other devices they own will also be moved if the onlyDevice option is not true.

The devices array must have at least one item and at most 20. UDIDs will not be deduplicated in this method.

restartDevice(udid: string, options?: APIRestartDeviceOptions): Promise<RouteData<"POST /devices/:udid/restart">>

(Add) Schedule the device to restart.

wipeDevice(udid: string, options?: APIWipeDeviceOptions): Promise<RouteData<"POST /devices/:udid/wipe">>

(Add) Schedule wiping a device of all its data, without changing the user the device is assigned to in Jamf School.

getDeviceGroup(id: number): Promise<RouteData<"GET /devices/groups/:id">["deviceGroup"]>

(Read) Get a single device group by its ID.

getDeviceGroups(): Promise<RouteData<"GET /devices/groups">["deviceGroups"]>

(Read) Get all device groups.

updateDeviceGroup(id: number, options: APIDeviceGroupData): Promise<RouteData<"PUT /devices/groups/:id">>

(Edit) Update an existing device group's details.

updateDevice(udid: string, options: APIDeviceData): Promise<RouteData<"POST /devices/:udid/details">>

(Edit) Update an existing device group's details.

updateUserGroup(id: number, options: APIUserGroupData): Promise<RouteData<"PUT /users/groups/:id">>

(Edit) Update an existing user group's details.

getUser(id: number): Promise<RouteData<"GET /users/:id">["user"]>

(Read) Get a single user by their ID.

getUsers(): Promise<RouteData<"GET /users">["users"]>

(Read) Get all users.

updateUser(id: number, data: APIUserData): Promise<RouteData<"PUT /users/:id">>

(Edit) Update an existing user's details.

moveUser(
userId: number,
locationId: number,
): Promise<RouteData<"PUT /users/:id/migrate">>

(Edit) Move the user and their devices to a new location.

getUserGroup(id: number): Promise<RouteData<"GET /users/groups/:id">["group"]>

(Read) Get a single user group by their ID.

getUserGroups(): Promise<RouteData<"GET /users/groups">["groups"]>

(Read) Get all user groups.

getApps(): Promise<RouteData<"GET /apps">["apps"]>

(Read) Get all apps.

getApp(id: number): Promise<RouteData<"GET /apps/:id">>

(Read) Get a single app by its ID.

The ID used is a Jamf School ID, not the app's App Store ID.

getLocations(): Promise<RouteData<"GET /locations">["locations"]>

(Read) Get all locations.

getLocation(id: number): Promise<RouteData<"GET /locations/:id">>

(Read) Get a single location by its ID (zero-indexed).

getProfile(id: number): Promise<RouteData<"GET /profiles/:id">>

(Read) Get a single profile by its ID.

getProfiles(): Promise<RouteData<"GET /profiles">["profiles"]>

(Read) Get all the profiles on your instance.