You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module is a api handler module for the go-api-http-client to accommodate specifics of
3
-
jamf's api(s). It handles the encoding (marshalling) and decoding (unmarshalling)
4
-
of data. It also sets the correct content headers for the various http methods.
1
+
# Jamf Pro API Handler
5
2
6
-
This module integrates with the go-api-http-client logger for wrapped error handling
7
-
for human readable return codes. It also supports the go-api-http-client tiered logging
8
-
functionality for logging support.
3
+
The Jamf Pro API Handler is an integral component of the Go API HTTP Client, designed specifically for seamless integration with the Jamf Pro API. This handler facilitates the encoding and decoding of requests and responses, manages API-specific headers, and constructs endpoints for efficient API communication.
9
4
10
-
The logic of this module is defined as follows:
5
+
## Features
6
+
7
+
-**Endpoint Construction**: Dynamically constructs API resource and authentication endpoints based on the instance name and predefined URL patterns.
8
+
-**Content-Type Handling**: Determines the appropriate `Content-Type` header for requests, with specialized handling for both the Classic API (XML) and the JamfPro API (JSON).
9
+
-**Accept Header Management**: Generates a weighted `Accept` header to indicate the client's capability to process various MIME types, prioritizing XML for compatibility with the Classic API.
10
+
-**Standard Headers**: Provides a set of standard headers required for API requests, including `Accept`, `Content-Type`, and `Authorization`.
11
+
-**Request Marshaling**: Encodes request bodies into the appropriate format (XML or JSON) based on the target API endpoint, with support for multipart/form-data encoding for file uploads.
12
+
-**Response Handling**: Processes API responses, decoding them into the desired data structures and handling binary data responses where applicable.
13
+
14
+
The logic of this api handler is defined as follows:
11
15
Classic API:
12
16
13
17
For requests (GET, POST, PUT, DELETE):
@@ -33,3 +37,42 @@ For responses (DELETE):
33
37
Headers
34
38
- Sets accept headers based on weighting. Jamf Pro API doesn't support XML, so MIME type is skipped and returns JSON
35
39
- Set content header as application/json with edge case exceptions based on need.
40
+
41
+
42
+
## Usage
43
+
44
+
To utilize the Jamf Pro API Handler within the Go API HTTP Client, instantiate the client with the Jamf Pro-specific configuration:
0 commit comments