Welcome Guest, Not a member yet? Register   Sign In
REST does not support PATCH!?
#1

From the docs it seems that PATCH redirect to PUT (as well as PUT itself) ... as if PATCH by itself is not supported. Why is that? And how would I make it support it?
I need different handling for the two ...
Reply
#2

> PATCH redirect to PUT

No, a PATCH request is routed to the same method as a PUT request.

> Why is that?

Maybe the both of them are updating something.

> I need different handling for the two ...

PHP Code:
if ($this->request->getMethod() === 'patch') {
    return $this->patch(...);
} else {
    return $this->post(...);

Reply
#3

This is a good read on it.

Use of PUT vs PATCH methods in REST API real life scenarios
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(This post was last modified: 12-03-2021, 03:54 AM by blaasvaer.)

Yes, I did all the reading I could find. It didn't leave me that much wiser to be honest.
What I'm basically struggling with is the issue of setting a datetime-local input to NULL, but when serializing the data on the front end, the value simply turns into an empty string (?published_at=) or no value (which again gets received on the server as an empty string). I guess a datetime-local input cannot be set to null, as it is: value="" (empty string).
Now, I need to pass null to the DB in order for the published_at timestamp field to be 'empty' (NULL – default). But since the CI Rest won't let me fiddle with the value on the server ... as it is a black box, I cannot check for the key 'published_at' and set it accordingly as I do in my nodejs version. I'm trying to fix it at the front end level, but still haven't found a way around the serialize problem which will always turn value="" into an empty string in the serialized output.

Christ, I ALWAYS seem to tick the wrong button below for getting notifications, UX, anyone?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB