Method: Jamf::Connection::JamfProAPI#jp_patch

Defined in:
lib/jamf/api/connection/jamf_pro_api.rb

#jp_patch(rsrc, data = nil) ⇒ String Also known as: patch

Update an existing Jamf Pro API resource

Parameters:

  • rsrc (String)

    the API resource being changed, the URL part after ‘api/’

  • data (String) (defaults to: nil)

    the json specifying the changes.

Returns:

  • (String)

    the response from the server.

Raises:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/jamf/api/connection/jamf_pro_api.rb', line 124

def jp_patch(rsrc, data = nil)
  validate_connected

  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
  resp = @jp_cnx.patch(rsrc) do |req|
    # Patch requests must use this content type!
    req.headers['Content-Type'] = 'application/merge-patch+json'
    req.body = data if data
  end

  @last_http_response = resp
  return resp.body if resp.success?

  raise Jamf::Connection::JamfProAPIError, resp
end