Page 1 of 1

Send PATCH requests in lieu of POST

Posted: Tue Aug 06, 2019 8:39 pm
by tasdvl9
Hello,

I've been researching a way to send a PATCH request and have been coming up short. Is there an example someone can share? I'm using the libSOAP library and while it has been working well with post requests I'm uncertain if I can leverage it for patch requests as well.

Thanks in advance.

Re: Send PATCH requests in lieu of POST

Posted: Wed Aug 07, 2019 5:24 am
by mwieder
Well, as the author of the libSOAP library I suppose I should chime in here with something. I have to say that I haven't looked at that code in several years now, but...

The libURL library that underlies all the http code supports the GET, POST, PUT, and DELETE verbs. You'd have to er... patch... the library to add PATCH to the supported http verbs and then add the patchUrl handler to the library in order to have this work. Patch would be a useful addition to the libURL library, and I'd say that probably the thing to do would be to file an enhancement request and wait around for someone on the team to implement it.

I don't know if tsNet supports the PATCH verb, but if you have a Business license you might look into that.

Re: Send PATCH requests in lieu of POST

Posted: Wed Aug 07, 2019 1:46 pm
by tasdvl9
Thanks for the reply!

I imagine the other way to issue the PATCH request would be to call curl within my application. Not a problem as I've done this before. I'll also file an enhancement request as I do believe adding PATCH to the existing http verbs would be beneficial.

Re: Send PATCH requests in lieu of POST

Posted: Wed Aug 07, 2019 4:45 pm
by mwieder
yeah, shelling out to curl (although I prefer httpie) would also do the job as long as you take care package up the parameters properly. And you'd get results much faster than waiting for an enhancement request to be fulfilled.

Post the bug report number here when you've filed it. I'll add my two cents' worth.

Re: Send PATCH requests in lieu of POST

Posted: Sun Aug 11, 2019 10:58 am
by mimu
You can try to set the Header:
"X-HTTP-Method-Override: PATCH"

And then send a post request with this Header set