Reputation: 93
I am working on an API that will take an xml file, parse the file to a DTO and return the results in the form of JSON. Technically you can say the API's purpose is to only parse the file and return the results in a "nice" format. I'm not sure whether or not it makes more sense to make this a POST vs PUT api? I know POST is usually for create and PUT is for update. In this case I'm not really creating or updating anything.
Upvotes: 0
Views: 927
Reputation: 99851
The purpose of PUT
is to replace what exists at your target url.
So if you do a PUT request with a file on /foo/bar
, then I would expect a GET
request afterwards on /foo/bar
to return that same file.
It doesn't sound like that's what you're doing, so POST
is likely the right choice.
Upvotes: 1
Reputation: 57397
If you aren't doing something standard, it's okay to use POST.
POST serves many useful purposes in HTTP, including the general purpose of “this action isn’t worth standardizing.”
Upvotes: 3