How to use PATCH verb with curl

How to use PATCH verb with curl - Stack Overflow

http://stackoverflow.com/questions/16306624/how-to-use-patch-verb-with-curl


This is the format you should use:

curl --request PATCH https://api.viafoura.com/v2/dev.viafoura.com/pages/7000000043515?status=closed

Using-Xdoesn't seem to work in terms of sending a PATCH request - you have to use--request PATCH. Also, that API seems to want thestatusparameter as a query parameter on the url, not part of the PATCH body.

At this point the server is going to return a 401 error: "You must be logged in to modify page settings." Assumedly you have to login first with something like this:

curl --request POST "https://api.viafoura.com/v2/dev.viafoura.com/users/[email protected]"

I've used the credentials from their documentation in that example, which I figured would work on their dev server, but its currently returning an "Incorrect password" error.

If you have valid credentials, though, you should get back a session cookie which you can then use to authenticate your PATCH request.



An alternative way is as follow, this is through a POST call though

curl --data status=closed https://api.viafoura.com/v2/dev.viafoura.com/pages/7000000043515?verb=PATCH

I am guessing this is not a general way and only applies to this specific instance.

你可能感兴趣的:(How to use PATCH verb with curl)