Post parameter in path or in body

前端 未结 1 919
鱼传尺愫
鱼传尺愫 2021-01-05 17:11

I am creating Rest API but I am confused in URL structure. I have to send just one parameter to server in my Post request. should I send it through path variable or in reque

1条回答
  •  再見小時候
    2021-01-05 17:54

    URL usually identifies resource you want to update.

    So the data should go inside in request body

    To update user name you may send this to server:

    POST api/v1/users/{id} HTTP/1.1
    Content-Type: application/x-www-form-urlencoded
    
    name=string
    

    0 讨论(0)
提交回复
热议问题