Skip to content

Commit 405be5b

Browse files
authored
Merge pull request #48 from deploymenttheory/dev
Added SDK coverage for Mobile Device Applications with examples
2 parents 68d14ca + dd3a353 commit 405be5b

File tree

20 files changed

+1577
-6
lines changed

20 files changed

+1577
-6
lines changed

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,65 @@ This documentation outlines the API endpoints available for managing Licensed So
855855
- [x] ✅ **DELETE** `/JSSResource/licensedsoftware/name/{name}`
856856
`DeleteLicensedSoftwareByName` deletes a Licensed Software item by its name.
857857
858+
### Jamf Pro Classic API - Mobile Device Applications
859+
860+
This documentation outlines the API endpoints available for managing Mobile Device Applications within Jamf Pro using the Classic API, which supports XML data structures.
861+
862+
## Endpoints
863+
864+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications`
865+
`GetMobileDeviceApplications` retrieves a serialized list of all Mobile Device Applications.
866+
867+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/id/{id}`
868+
`GetMobileDeviceApplicationByID` fetches details of a single Mobile Device Application by its ID.
869+
870+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/name/{name}`
871+
`GetMobileDeviceApplicationByName` retrieves details of a Mobile Device Application by its name.
872+
873+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}`
874+
`GetMobileDeviceApplicationByAppBundleID` fetches details of a Mobile Device Application by its Bundle ID.
875+
876+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}/version/{version}`
877+
`GetMobileDeviceApplicationByAppBundleIDAndVersion` fetches details of a Mobile Device Application by its Bundle ID and specific version.
878+
879+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/id/{id}/subset/{subset}`
880+
`GetMobileDeviceApplicationByIDAndDataSubset` fetches a Mobile Device Application by its ID and a specified data subset.
881+
882+
- [x] ✅ **GET** `/JSSResource/mobiledeviceapplications/name/{name}/subset/{subset}`
883+
`GetMobileDeviceApplicationByNameAndDataSubset` fetches a Mobile Device Application by its name and a specified data subset.
884+
885+
- [x] ✅ **POST** `/JSSResource/mobiledeviceapplications/id/0`
886+
`CreateMobileDeviceApplication` creates a new Mobile Device Application. The ID `0` in the endpoint indicates creation.
887+
888+
- [x] ✅ **PUT** `/JSSResource/mobiledeviceapplications/id/{id}`
889+
`UpdateMobileDeviceApplicationByID` updates an existing Mobile Device Application by its ID.
890+
891+
- [x] ✅ **PUT** `/JSSResource/mobiledeviceapplications/name/{name}`
892+
`UpdateMobileDeviceApplicationByName` updates an existing Mobile Device Application by its name.
893+
894+
- [x] ✅ **PUT** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}`
895+
`UpdateMobileDeviceApplicationByApplicationBundleID` updates an existing Mobile Device Application by its Bundle ID.
896+
897+
- [x] ✅ **PUT** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}/version/{version}`
898+
`UpdateMobileDeviceApplicationByIDAndAppVersion` updates an existing Mobile Device Application by its ID and specific version.
899+
900+
- [x] ✅ **DELETE** `/JSSResource/mobiledeviceapplications/id/{id}`
901+
`DeleteMobileDeviceApplicationByID` deletes a Mobile Device Application by its ID.
902+
903+
- [x] ✅ **DELETE** `/JSSResource/mobiledeviceapplications/name/{name}`
904+
`DeleteMobileDeviceApplicationByName` deletes a Mobile Device Application by its name.
905+
906+
- [x] ✅ **DELETE** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}`
907+
`DeleteMobileDeviceApplicationByBundleID` deletes a Mobile Device Application by its Bundle ID.
908+
909+
- [x] ✅ **DELETE** `/JSSResource/mobiledeviceapplications/bundleid/{bundleid}/version/{version}`
910+
`DeleteMobileDeviceApplicationByBundleIDAndVersion` deletes a Mobile Device Application by its Bundle ID and specific version.
911+
858912
859913
## Progress Summary
860914
861-
- Total Endpoints: 284
862-
- Covered: 265
915+
- Total Endpoints: 300
916+
- Covered: 281
863917
- Not Covered: 19
864918
- Partially Covered: 0
865919
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/http_client" // Import http_client for logging
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json"
14+
15+
// Load the client OAuth credentials from the configuration file
16+
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to load client OAuth configuration: %v", err)
19+
}
20+
21+
// Instantiate the default logger and set the desired log level
22+
logger := http_client.NewDefaultLogger()
23+
logLevel := http_client.LogLevelDebug // LogLevelNone // LogLevelWarning // LogLevelInfo // LogLevelDebug
24+
25+
// Configuration for the jamfpro
26+
config := jamfpro.Config{
27+
InstanceName: authConfig.InstanceName,
28+
LogLevel: logLevel,
29+
Logger: logger,
30+
ClientID: authConfig.ClientID,
31+
ClientSecret: authConfig.ClientSecret,
32+
}
33+
34+
// Create a new jamfpro client instance
35+
client, err := jamfpro.NewClient(config)
36+
if err != nil {
37+
log.Fatalf("Failed to create Jamf Pro client: %v", err)
38+
}
39+
40+
// Define a new mobile device application
41+
newApp := &jamfpro.ResponseMobileDeviceApplication{
42+
General: jamfpro.MobileDeviceApplicationGeneral{
43+
Name: "Jamf Self Service",
44+
DisplayName: "Jamf Self Service",
45+
Description: "Jamf Self Service empowers you to be more productive...",
46+
BundleID: "com.jamfsoftware.selfservice",
47+
Version: "10.10.6",
48+
InternalApp: true,
49+
OsType: "iOS", // iOS or tvOS
50+
Category: jamfpro.MobileDeviceApplicationCategory{
51+
ID: -1,
52+
Name: "No category assigned",
53+
},
54+
IPA: jamfpro.MobileDeviceApplicationIPA{
55+
// Set IPA details here
56+
},
57+
Icon: jamfpro.MobileDeviceApplicationIcon{
58+
ID: 27,
59+
Name: "1024x1024bb.png",
60+
URI: "string",
61+
Data: "Base64EncodedString",
62+
},
63+
// ... other fields ...
64+
},
65+
Scope: jamfpro.MobileDeviceApplicationScope{
66+
// Populate the Scope details
67+
},
68+
SelfService: jamfpro.MobileDeviceApplicationSelfService{
69+
SelfServiceDescription: "Jamf Self Service empowers you...",
70+
// ... other fields ...
71+
},
72+
VPP: jamfpro.MobileDeviceApplicationVPP{
73+
// Populate the VPP details
74+
},
75+
AppConfiguration: jamfpro.MobileDeviceApplicationConfiguration{
76+
Preferences: "",
77+
},
78+
}
79+
80+
createdApp, err := client.CreateMobileDeviceApplication(newApp)
81+
if err != nil {
82+
fmt.Println("Error creating mobile device application:", err)
83+
} else {
84+
fmt.Println("Created Mobile Device Application:", createdApp)
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/http_client" // Import http_client for logging
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json"
14+
15+
// Load the client OAuth credentials from the configuration file
16+
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to load client OAuth configuration: %v", err)
19+
}
20+
21+
// Instantiate the default logger and set the desired log level
22+
logger := http_client.NewDefaultLogger()
23+
logLevel := http_client.LogLevelDebug // LogLevelNone // LogLevelWarning // LogLevelInfo // LogLevelDebug
24+
25+
// Configuration for the jamfpro
26+
config := jamfpro.Config{
27+
InstanceName: authConfig.InstanceName,
28+
LogLevel: logLevel,
29+
Logger: logger,
30+
ClientID: authConfig.ClientID,
31+
ClientSecret: authConfig.ClientSecret,
32+
}
33+
34+
// Create a new jamfpro client instance
35+
client, err := jamfpro.NewClient(config)
36+
if err != nil {
37+
log.Fatalf("Failed to create Jamf Pro client: %v", err)
38+
}
39+
40+
// Define the ID of the mobile device application you want to delete
41+
bundleID := "com.example.bundleid" // Replace with the actual ID of the application you want to delete
42+
43+
// Perform the deletion
44+
err = client.DeleteMobileDeviceApplicationByBundleID(bundleID)
45+
if err != nil {
46+
fmt.Println("Error deleting mobile device application:", err)
47+
} else {
48+
fmt.Println("Mobile Device Application deleted successfully")
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/http_client" // Import http_client for logging
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json"
14+
15+
// Load the client OAuth credentials from the configuration file
16+
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to load client OAuth configuration: %v", err)
19+
}
20+
21+
// Instantiate the default logger and set the desired log level
22+
logger := http_client.NewDefaultLogger()
23+
logLevel := http_client.LogLevelDebug // LogLevelNone // LogLevelWarning // LogLevelInfo // LogLevelDebug
24+
25+
// Configuration for the jamfpro
26+
config := jamfpro.Config{
27+
InstanceName: authConfig.InstanceName,
28+
LogLevel: logLevel,
29+
Logger: logger,
30+
ClientID: authConfig.ClientID,
31+
ClientSecret: authConfig.ClientSecret,
32+
}
33+
34+
// Create a new jamfpro client instance
35+
client, err := jamfpro.NewClient(config)
36+
if err != nil {
37+
log.Fatalf("Failed to create Jamf Pro client: %v", err)
38+
}
39+
40+
// Define the bundle ID and version of the mobile device application to delete
41+
bundleID := "com.example.bundleid" // Replace with actual bundle ID
42+
version := "1.0.0" // Replace with actual version
43+
44+
// Perform the deletion
45+
err = client.DeleteMobileDeviceApplicationByBundleIDAndVersion(bundleID, version)
46+
if err != nil {
47+
fmt.Println("Error deleting mobile device application by bundle ID and version:", err)
48+
} else {
49+
fmt.Println("Successfully deleted mobile device application by bundle ID and version.")
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/http_client" // Import http_client for logging
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json"
14+
15+
// Load the client OAuth credentials from the configuration file
16+
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to load client OAuth configuration: %v", err)
19+
}
20+
21+
// Instantiate the default logger and set the desired log level
22+
logger := http_client.NewDefaultLogger()
23+
logLevel := http_client.LogLevelDebug // LogLevelNone // LogLevelWarning // LogLevelInfo // LogLevelDebug
24+
25+
// Configuration for the jamfpro
26+
config := jamfpro.Config{
27+
InstanceName: authConfig.InstanceName,
28+
LogLevel: logLevel,
29+
Logger: logger,
30+
ClientID: authConfig.ClientID,
31+
ClientSecret: authConfig.ClientSecret,
32+
}
33+
34+
// Create a new jamfpro client instance
35+
client, err := jamfpro.NewClient(config)
36+
if err != nil {
37+
log.Fatalf("Failed to create Jamf Pro client: %v", err)
38+
}
39+
40+
// Define the ID of the mobile device application you want to delete
41+
appName := "Jamf Self Service" // Replace with the actual ID of the application you want to delete
42+
43+
// Perform the deletion
44+
err = client.DeleteMobileDeviceApplicationByName(appName)
45+
if err != nil {
46+
fmt.Println("Error deleting mobile device application:", err)
47+
} else {
48+
fmt.Println("Mobile Device Application deleted successfully")
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/http_client" // Import http_client for logging
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json"
14+
15+
// Load the client OAuth credentials from the configuration file
16+
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to load client OAuth configuration: %v", err)
19+
}
20+
21+
// Instantiate the default logger and set the desired log level
22+
logger := http_client.NewDefaultLogger()
23+
logLevel := http_client.LogLevelDebug // LogLevelNone // LogLevelWarning // LogLevelInfo // LogLevelDebug
24+
25+
// Configuration for the jamfpro
26+
config := jamfpro.Config{
27+
InstanceName: authConfig.InstanceName,
28+
LogLevel: logLevel,
29+
Logger: logger,
30+
ClientID: authConfig.ClientID,
31+
ClientSecret: authConfig.ClientSecret,
32+
}
33+
34+
// Create a new jamfpro client instance
35+
client, err := jamfpro.NewClient(config)
36+
if err != nil {
37+
log.Fatalf("Failed to create Jamf Pro client: %v", err)
38+
}
39+
40+
// Define the ID of the mobile device application you want to delete
41+
appID := 3 // Replace with the actual ID of the application you want to delete
42+
43+
// Perform the deletion
44+
err = client.DeleteMobileDeviceApplicationpByID(appID)
45+
if err != nil {
46+
fmt.Println("Error deleting mobile device application:", err)
47+
} else {
48+
fmt.Println("Mobile Device Application deleted successfully")
49+
}
50+
}

0 commit comments

Comments
 (0)