restful-architecture

Why is using a HTTP GET to update state on the server in a RESTful call incorrect?

霸气de小男生 提交于 2019-12-04 03:05:25
问题 OK, I know already all the reasons on paper why I should not use a HTTP GET when making a RESTful call to update the state of something on the server. Thus returning possibly different data each time. And I know this is wrong for the following 'on paper' reasons: HTTP GET calls should be idempotent N > 0 calls should always GET the same data back Violates HTTP spec HTTP GET call is typically read-only And I am sure there are more reasons. But I need a concrete simple example for justification

CustomAuthorizationPolicy.Evaluate() method never fires in wcf webhttpbinding

守給你的承諾、 提交于 2019-12-03 20:45:03
问题 I create a wcf service as you can see : [OperationContract] [PrincipalPermission(SecurityAction.Demand, Role = "Admin")] [WebInvoke(Method = "GET", UriTemplate = "/Data/{data}")] string GetData(string data); So I create a custom authorize as you can see : public class AuthorizationPolicy : IAuthorizationPolicy { string id = Guid.NewGuid().ToString(); public string Id { get { return this.id; } } public System.IdentityModel.Claims.ClaimSet Issuer { get { return System.IdentityModel.Claims

Named restful routes in Laravel 4

你。 提交于 2019-12-03 08:51:16
问题 So, I've been able to get restful controllers working with Route::controller('users','UserController'); class UserController extends BaseController { public function getAccount(){} } and so /users/account works. However if I try to do something like Route::any('account',array('as' => 'account','uses' => 'UserController@account')); and go to /account , it doesn't work ( NotFoundHTTPException ). Is there a way to use named routes and restful controllers in conjunction? I like how the restful

How to structure REST resource hierarchy?

让人想犯罪 __ 提交于 2019-12-03 06:57:57
问题 I'm new to server side web development and recently I've been reading a lot about implementing RESTful API's. One aspect of REST API's that I'm still stuck on is how to go about structuring the URI hierarchy that identifies resources that the client can interact with. Specifically I'm stuck on deciding how detailed to make the hierarchy and what to do in the case of resources being composed of other resource types. Here's an example that hopefully will show what I mean. Imagine we have a web

Way to specify resource's fields list in RESTful API request

≡放荡痞女 提交于 2019-12-03 05:36:43
问题 I have RESTful API within a web-service with some kind of resources like users, posts and so on. When I make request for list of posts (GET /posts), I want to retrieve array of posts only with reduced part of data for each post (i.e. subject, author name). When I make request for concrete post (GET /posts/42) I want to retrieve full list of post object fields, including big post body, additional info about likes count, comments count. I suppose it is exists many ways to solve this problem. In

RESTful API: Where should I code my workflow?

孤人 提交于 2019-12-03 02:33:11
I am developing a RESTful API. This is my first API, but also my first really big coding project. As such, I'm still learning a lot about architecture etc. Currently, I have my api setup in the following layers: HTTP Layer Resource Layer Domain Model / Business Logic Layer Data Access / Repository Layer Persistent Storage / DB Layer The issue I have run into at the moment is where do I need to put workflow objects / managers? By workflows, I mean code that evaluates what next step is required by the end user. For example, an e-commerce workflow. User adds item to basket, then checks out, then

What is the difference between resource and endpoint?

亡梦爱人 提交于 2019-12-03 01:32:47
问题 I have heard both "resource" and "endpoint" to refer to the same thing. It seems that resource is a newer term. What is the difference between them? Does "resource" imply a RESTful design? 回答1: REST Resource is a RESTful subset of Endpoint . An endpoint by itself is the location where a service can be accessed: https://www.google.com # Serves HTML 8.8.8.8 # Serves DNS /services/service.asmx # Serves an ASP.NET Web Service A resource refers to one or more nouns being served, represented in

Laravel 4 as RESTful backend for AngularJS

旧城冷巷雨未停 提交于 2019-12-03 01:25:17
问题 I am trying to build a web application which should use Laravel as a RESTful backend API and AngularJS on client side. I read all the other post on Stackoverflow about the issue, but no one is definitely answering my doubts, at least, I did not find a definitive source example. For instance... Should I develop two completely distinct applications, a backend one with Laravel and another, purely client, with AngularJS? But in this case: how to handle them through a single domain (or virtual

Questions About Consuming Your Own API with OAuth

六月ゝ 毕业季﹏ 提交于 2019-12-03 00:33:42
问题 I'm building a RESTful API for a project I'm working on and I'd like to make the main application consume the API because: It will result in having one set of code to maintain Should we decide to expose the API for 3rd party devs it will already be done It opens up the possibility to make mobile applications that consume it I really want to learn how to do it The API will be hosted on a subdomain https://api.example.com and the main web application will be hosted at the root domain https:/

How to structure REST resource hierarchy?

帅比萌擦擦* 提交于 2019-12-02 21:36:21
I'm new to server side web development and recently I've been reading a lot about implementing RESTful API's. One aspect of REST API's that I'm still stuck on is how to go about structuring the URI hierarchy that identifies resources that the client can interact with. Specifically I'm stuck on deciding how detailed to make the hierarchy and what to do in the case of resources being composed of other resource types. Here's an example that hopefully will show what I mean. Imagine we have a web service that lets users buy products from other users. So in this simple case, there are two top level