Skip to content

PUT on /resource/non-existing-id should work according to the HTTP spec #4344

@soyuka

Description

@soyuka
Member

Activity

added this to the 3.0 milestone on Jul 1, 2021
rugolinifr

rugolinifr commented on Jul 3, 2021

@rugolinifr

Do you mean that the request must create if it does not exist ?

If so, I am a bit worried:

  • How to handle security ? for example, the current user is not allowed to POST the resource, but is allowed to PUT. What security rule/ voter is applied when the identified resource does not exist ?

  • How will behave security and security_post_denormalize keywords ?

  • What if the identified resource exists within the persistence storage, but it's excluded by the data provider because of some QueryItemExtensionInterface ?

  • What about resources with different denormalization groups on POST and PUT requests ? For example when you define a property at creation that can't be updated after ?

thanks in advance for your answer

dunglas

dunglas commented on Jul 3, 2021

@dunglas
Member

Basically our current PUT implementation behaves more or less like a PATCH. The idea here, now that PATCH is properly supported (that wasn't the case initially), is to respect the true semantic of the PUT request and to encourage using PATCH for the use cases you describe.

To prevent any BC break, we plan to introduce a new attribute in 2.7 (set to false by default, but triggering a deprecation warning is not set to true) to enable the standard behavior (if set to false, the current behavior will be preserved). In 3.0 we'll remove the non-standard behavior.

rugolinifr

rugolinifr commented on Jul 3, 2021

@rugolinifr

Ok I see. I'll take a look at the PATCH method then.

Thanks

modified the milestones: 3.0, 4.0 on Nov 21, 2022
soyuka

soyuka commented on Jan 4, 2023

@soyuka
MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dunglas@soyuka@rugolinifr

        Issue actions

          PUT on /resource/non-existing-id should work according to the HTTP spec · Issue #4344 · api-platform/core