English 中文(简体)
REST API / DATA MODEL DESIGN - User , Account or Both Models?
原标题:

I m having some thoughts about proper building my app and provide a good and consistent API for it but now I m having some doubts about the user/accounts model.

It s funny but if you consider some apps you will see that they treat you like user but when editing your details your are redirect to account.

One good example of this is twitter.

So I would like to know your opinion about what s the best method to build this kind of architecture?

Is the account really necessary?

Why should I use account or user?

If I decide to implement a payment instruction for that user later, should that user store that information inside a account which stores his password and other important information?

sorry but I m kind of lost on this subject sometimes it looks that other apps use more models than the necessary, so I m not sure :(

I was thinking I m have to associated models like this:

 User has_one :account

But I still not sure what kind of information goes into the User and Account.

Thanks in advance for you help

Cheers

最佳回答

It really depends on the application. Look at telephones for example. One household or company may have one or more telephones billed together, so telephone number is not the same as account number.

For many web applications, there is one account for one user and vice versa. I can open several accounts, one as "Mark the computer guy", one as "Mark the pianist" and so on. So a user is not a real person but more like a persona, or a character I play. If my music career really takes off I might hire a P.R. person to manage my "Mark the pianist" account. In this case the application could tie "user" and "account" together: one account for each "persona". This is good for a free app.

For a different example, look at a web hosting service that costs money. I might create one account and then set up several users who can log on: me, my web developer, my systems administrator, etc. So there s one account for several users.

问题回答

暂无回答




相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签