How is a HTTP PUT request typically issued?

后端 未结 5 1938
天涯浪人
天涯浪人 2021-02-05 06:31

I know HTTP PUT is an idempotent request that store something at a specific URI, according to the definition (quoted from the rfc)

The PUT method requests that t         


        
5条回答
  •  礼貌的吻别
    2021-02-05 07:36

    In REST you have:

    GET - retrieve resource
    POST - create new resource
    PUT - update existing resource
    DELETE - delete resource
    

    So the PUT verb is used to update an existing resource on the server. Depending on the client there are various ways of sending a PUT request. For example with jquery AJAX:

    $.ajax({
        type: 'PUT',
        url: '/products/123',
        data: { name: 'new product name' }
    });
    

提交回复
热议问题