Welcome Guest, Not a member yet? Register   Sign In
Working on a REST API, critique requested
#16

[eluser]Phil Sturgeon[/eluser]
Aha, worked out the rest. I updated the example above for the methods to be properly REST and not just GET calls.

That could be called via example.com/api/something with HTTP_ACCEPT set to GET or DELETE and to add support PUT for POST, just write a new method in.

Params come from $this->uri->uri_to_assoc() and passed back to the controller via the $this->args property. Then we can use URL's like...

Code:
example.com/api/something/id/1

You'd be able to send HTTP_ACCEPT as get or delete as they are the only two listed in the controller, anything else would fail.


Messages In This Thread
Working on a REST API, critique requested - by El Forum - 05-29-2009, 08:13 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:15 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:25 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:30 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:35 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:37 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:39 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:43 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:48 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 09:55 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 10:03 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 10:31 AM
Working on a REST API, critique requested - by El Forum - 05-29-2009, 12:45 PM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 03:53 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 05:10 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 05:29 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 08:27 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 08:28 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 09:21 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 09:26 AM
Working on a REST API, critique requested - by El Forum - 06-03-2009, 09:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB