Send PATCH requests in lieu of POST

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tasdvl9
Posts: 94
Joined: Fri Dec 06, 2013 3:55 am

Send PATCH requests in lieu of POST

Post by tasdvl9 » Tue Aug 06, 2019 8:39 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Send PATCH requests in lieu of POST

Post by mwieder » Wed Aug 07, 2019 5:24 am

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.

tasdvl9
Posts: 94
Joined: Fri Dec 06, 2013 3:55 am

Re: Send PATCH requests in lieu of POST

Post by tasdvl9 » Wed Aug 07, 2019 1:46 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Send PATCH requests in lieu of POST

Post by mwieder » Wed Aug 07, 2019 4:45 pm

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.

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 76
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Send PATCH requests in lieu of POST

Post by mimu » Sun Aug 11, 2019 10:58 am

You can try to set the Header:
"X-HTTP-Method-Override: PATCH"

And then send a post request with this Header set

Post Reply

Return to “Talking LiveCode”