restful-url

a restful api only uses clean urls - no url variables or post variables

点点圈 提交于 2019-12-07 13:47:26
A restful api has to use either get, post, put or delete request methods. The behavaiour and data submitted is entirely determined by the uri string. No query paramters or post variables. Is this true ? Valid : http://example.com/foo/84 Not valid : http://example.com/foo/?value=84 Valid : $.ajax({ type: 'POST', url: "http://example.com/foo/84", success: success, dataType: dataType }); Not valid : $.ajax({ type: 'POST', url: "http://example.com/foo/", data: 84, success: success, dataType: dataType }); edit Two answers so far, and the contradict each other. Saying that http://example.com/foo/

Laravel 4: how to write the correct nested controller for nested resource?

南笙酒味 提交于 2019-12-07 07:48:06
问题 In Laravel 4, I wish to create a set of restful resources as follows: http://localhost/posts/1/comments http://localhost/posts/1/comments/1 http://localhost/posts/1/comments/1/edit ... So I created two controllers: PostsController and CommentsController (on the same layer), and the routes are written as below: Route::resource('posts', 'PostsController'); Route::resource('posts.comments', 'CommentsController'); I also created a link in /views/comments/index.blade.php referring to routes: posts

Is an API endpoint that differentiates what resources to return based on user credentials RESTful and good URI design?

血红的双手。 提交于 2019-12-06 17:10:54
问题 Important note The focus of this question is on API endpoints that differentiate which resources are returned depending who authenticates , e.g. Alice gets resource A and B returned, and Bob gets resource X and Y. It is NOT about differentiating the representation of resources returned. All the endpoints return JSON representations of resources. Preface Please consider the following three potential API endpoint designs, all returning thing resources of a user. Endpoint A GET /things If

how to parse huge JSON data froma url or restful service in android?without GSON

血红的双手。 提交于 2019-12-06 14:35:19
问题 i have a Rest ful service,.. and i am getting a JSON data like,.. { "returnCode": "success", "RecievedData": { "results": [ { "details": [ { "moredetails": [{ "id": "123456", "price": "129.99", "recorded_at": 3223322, "lastrecorded_at": 0002020, "seller": "google", "availability": "Available", "currency": "USD" }], "offers_count": 1, "name": "google.com", "recentoffers_count": 1, "sid": "988008555566649", "url": "http://google.com" }, "moredetails"{ . . } ] details { { [ ] } "model": "abc",

Multiple query parameter RESTful URL with .htaccess

穿精又带淫゛_ 提交于 2019-12-06 11:17:25
I would like to use following RESTful URL for a web site I'm working on. http://mysite.com/Products/category=bags&colours=black can anyone please tell me how to achieve this with .htaccess? Oscar Here's an .htaccess to capture anything except when files or directories conflict and it routes to /index.php: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> With that we can use /index.php as our request router. In PHP we simply get the request

Restlet, An example of a get with parameters

左心房为你撑大大i 提交于 2019-12-06 08:49:36
Just startred using restlet with java and was pleasently surprised how easy it was. However this was with puts. I then started to work with get but couldn't work out how to pass infromation with the get. With the put it was easy as: @Put public Boolean store(Contact contact); But when i try and do this with get it doesnt work. From reading around i think i have to not pass it any parameters and just have this: @Get public Contact retrieve(); and then pass the parameters in a url or something? But i cant find any info on how to do this. As with put i could just use: resource.store(user1); Any

RESTful URL design: public vs private API, hierhachy API design pattern, URI vs URL design?

倖福魔咒の 提交于 2019-12-06 06:18:44
问题 I often get into issue like this, very similar to this Hierarchical RESTful URL design Supposed the service only offers the user to upload a document. POST, GET /accounts PUT, DELETE /accounts/{name} or /accounts/{id} Now a document is attached to a specific user, whether it is public or not at all is not of concerned here. The two ways are POST /documents vs POST /users/documents Why? Because later when a document resource is created, that document is under the user's control. So I would

Laravel resource controllers for both API and non-API use

醉酒当歌 提交于 2019-12-06 05:10:39
问题 After creating a resource controller PhotosController for a website that also does AJAX calls to the API, it appears that the resource controller can be used on both the normal website and as the API. This displays a HTML page for Photo with id = 1 http://domain.com/photos/1 and Javascript uses the following which updates the Photo resource and returns a JSON response PUT http://domain.com/api/v1/photos/1 Question: Will we have 2 PhotoControllers , one to handle API usage and one for non-API?

Make a REST URL call to another service by filling the details from the form

痴心易碎 提交于 2019-12-06 05:06:19
I have recently started working with Spring MVC framework. I made a lot of progress while reading lots of tutorial on the net. Background about my application- I have to make a REST URL call to another service (deployed already on tomcat) by using details provided in the form. So I have already made a form using JSP whose content is something like this as shown in the picture- I am not sure how can I make a REST url call by making the url from the form entries and then show the response of that url on the next screen. So in the above form if I have written User Id as 1000012848 , and checkbox

is restful meant for web services only OR for both web services AND web pages?

筅森魡賤 提交于 2019-12-06 03:29:53
问题 I read a lot of Restful tutorials for PHP. (I don't want to go in depth into why I am not using RoR. It is due to the team being more familiar with PHP) Because we are planning for future expansion into having APIs i read that it is important to implement Restful web services. I have looked at tutorials such as http://www.gen-x-design.com/archives/create-a-rest-api-with-php/ Apparently restful is meant for webservices. What about for webpages? can they be RESTFUL as well? if the answer is NO,