Hunter275 / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

Make macros more RESTful #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to make a macro that responds to anything other than POST

WebIOPi version used?
=> rev 1243

Python version used?
=> 3.2

Here's a patch to that does the following:
1. Allows macros to have their HTTP method specified (from GET, POST, PUT or 
DELETE), so that the API can be customized in a RESTful way.
2. Allows macros to receive arguments from any or all of the URL, query string, 
or request body.
3. Allow macros to specify their URL independently of the function name, and 
without needing the 'macros' prefix.
4. Handle the content-type header properly in both request and response.

It doesn't allow the HTTP response codes to be set though (other 2xx response 
codes, 404 etc. should be returned as appropriate to comply with the standards).

Also attached is a quick example of what this allows.

Original issue reported on code.google.com by mrevil@asvachin.eu on 12 Aug 2013 at 7:14

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 27 Nov 2013 at 9:11

GoogleCodeExporter commented 9 years ago
I agree the REST API is not RESTfull
But I cannot guarantee to integrate all your proposals.

Original comment by tro...@trouch.com on 27 Nov 2013 at 9:27

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:00

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:01

GoogleCodeExporter commented 9 years ago

Original comment by tro...@trouch.com on 28 Jan 2014 at 9:11