Reputation: 923
I used some web services and made my own. All of them were simple and they were only using simple GET requests like this:
http://foobar.com/api/movies?category=drama&apikey=bsbsbsbsbs
and a JSON data was output according to the parameters provided.
What I wanna do is a fileupload service. Normally if it wasn't a web service I would use HTTP POST for this. How can i do this with REST API? What's the difference between POST and GET requests with respect to REST web services.
Edit: I'm using PHP, please don't give ASP.net examples.
Upvotes: 0
Views: 9193
Reputation: 48
In REST you have the CRUD Methods ( Create, Read, Update, Delete) if you want to upload a file you need a PUT(Update) or POST(Create) method. The GET (Read) is only to get data from your Service not for Create, Update, Delete.
Here you will get some more information
http://www.ibm.com/developerworks/library/ws-restwsdl/
REST PHP Example:
http://coreymaynard.com/blog/creating-a-restful-api-with-php/
Upvotes: 1