Http: PATCH-action for an URL

I’d like to use a “PATCH”-URL command for an API (in this case evcc.io PATCH /api/loadpoints//vehicle).
In the docs, there’s GET, POST and PUT, but no PATCH-configuration or PATCH-action available.

Is there a way to use PATCH with http-binding? or do I have to use exec for a curl command out for that?

I didn’t think there’s an action for other commands like PATCH or DELETE or the like. You’ll have to either use raw HTTP stuff Java or curl I think.

I thought so. So I exec curl with the appropriate arguments.

For info: There is an action for DELETE, not for PATCH.

That’s what one gets by going from memory. Thanks for the correction.

just to be sure as I’m revisiting my rules: there’s still no “sendHttpPatchRequest” available? :wink:
still best to use curl via executeCommandline?

Which scripting language do you use?

One of the many possible ways to do this in JRuby.

require "net/http"
require "json"

uri = URI("https://example.com")
headers = { "Content-Type" => "application/json", "Authorization" => "Bearer token123" }
payload = { status: "active" }.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.send_request("PATCH", "/users/1", payload, headers)
end

logger.info "Response body: #{response.body}"

I’m using javascript (ECMA 262). I could include the JAVA-HttpClient class and do everything “by hand”, but that seems bloated - just to save some process spawning. Would be nice to have all HTTP methods sometime, but I can understand, if there’s noone except me using PATCH… :wink:

No, I’ve actually raised a request on GitHub, I need PATCH for Unifi API as well. Please upvote it there.

HTTP Patch action will be available in 5.3