hateoas, HATEOAS, an abbreviation for Hypermedia As The Engine Of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia provided dynamically by application servers. A REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia. By contrast, in some service-oriented architectures (SOA), clients and servers interact through a fixed interface shared through documentation or an interface description language (IDL).
put for Create, identifier is knows by the client.
put for update, existingId, full replacement.
put is idempotent, produce the same result regardless if that's called one time or hundred times. Because of that, it cannot be used for partial udpate, requires to send all the properties.
post as create, create on a parent resource
post as update, on instance resource - can be used for partial update.
post, only method not idempotent.
GET, PUT DELETE, HEAD are idempotent, invoke multiple times, should get the same result.
rest client vs browser
versioning
version in URL vs media type
hypermedia is paramount
linking is fundamental for scalability - not for performance, but the ability for other systems to interact, allow system to grow over time.
pagination
- offset
- limit
errors
- as descriptive as possible
- as much information as possible
- developers are your customers
security
- avoid sessions when possible
-- authenticate every request if necessary
-- stateless
- authorize based on resource content. NOT URL!
- Use existing protocol
-- oauth 1.0a, oauth2(begin with SSL, then translate to bear token), basic over SSL only
- custom authentication scheme
-- only if you provide client code/SDK
-- only if you really, really what you're doing
- use api keys instead of Username/Passwords
401 vs 403
- 401 "unauthorized" really means Unauthenticated
- 403 "forbidden" really means Unauthorized
api keys
- entropy
- password reset
- independence
- speed
- limited exposure
- traceability
- ids should be opaque
- should be globally unique
- avoid sequential numbers (contention, fusking)
- good candidates: UUIDs, 'Url64'
Maintaince
- use HTTP redirects
- create abstraction layer/endpoints when migrating
- use well defined custom Media Types
REST+JSON API Design - Best Practices for Developers
Jerry Ren
Tuesday, May 21, 2019
Friday, August 7, 2015
Cannot view wireless network after upgrade to windows 10
After upgrade my macbook pro from windows 8.1 to windows 10. I found that I couldn't see any wireless network. Thought it was caused by some missing driver issue, but turns out everything is fine in device manager.
After google around, I found following link on Microsoft. If you have unsupported vpn software installed, you will have this issue. Then I remember I have Cisco VPN Client installed for my other work.
To fix this problem
Talking about Cisco VPN Client, it's not compatible with windows 8 or windows 10. You have to get Anyconnect Secure Mobility Client, and it's not available to everyone.
Here is the link of how to make it working in windows 10. Enjoy
After google around, I found following link on Microsoft. If you have unsupported vpn software installed, you will have this issue. Then I remember I have Cisco VPN Client installed for my other work.
To fix this problem
1. open command prompt in admin mode
2. reg delete HKCR\CLSID{988248f3-alad-49bf-9170-676cbbc36ba3} /f
3. netcfg -v -u dni_dne
4. restart and see if you have any wireless network
Talking about Cisco VPN Client, it's not compatible with windows 8 or windows 10. You have to get Anyconnect Secure Mobility Client, and it's not available to everyone.
Here is the link of how to make it working in windows 10. Enjoy
Tuesday, February 4, 2014
"Update Model from Database" does not update column type
Due to spec changes, I need to change column type from nvarchar(500) to nvarchar(2000)
In the EF, when I try "Update Model from Database", the property still says "length:500".
To update the type of existing column, you can
1) delete entity from model and re-add it back, this is not ideal when you have navigation properties, :(
2) or use some third party tools, ie dbmltools
The reason why column type did not get updated, is because
Explanation from MSDN
for more info, see stack overflow link
In the EF, when I try "Update Model from Database", the property still says "length:500".
To update the type of existing column, you can
1) delete entity from model and re-add it back, this is not ideal when you have navigation properties, :(
2) or use some third party tools, ie dbmltools
The reason why column type did not get updated, is because
Explanation from MSDN
The ADO.NET Entity Data Model Designer (Entity Designer) uses the Update Model Wizard to update an .edmx file from changes made to the database. The Update Model Wizard overwrites the storage model as part of this process. The Update Model Wizard also makes some changes to the conceptual model and mappings, but it only makes these changes when objects are added to the database. For example, new entity types are added to the conceptual model when tables are added to the database, and new properties are added to entity types when columns are added to a table. For details about what changes are made to the .edmx file, see Changes Made to an .edmx File by the Update Model Wizard.
for more info, see stack overflow link
Saturday, January 18, 2014
Easy way to set up custom domain for Blogger on GoDaddy
While trying to find out how to set up custom domain for Blogger. I found this link showing step by step instruction, which I think it is really useful.
Step 1: In this article, it mentioned a tool which can help you set it up quickly. After enter your own domain, once click confirm, DNS will be set it up automatically for Blogger.
http://nz.godaddy.com/blog/bloggerdnssetup.aspx?isc=bb2470
Step 2: Last step, Blogger will give you two CNAMEs to enter on GoDaddy, one is a common one (Name:www, Destination: ghs.google.com), another one is for your blog only. Previous tool will set up the common one on Godaddy, all you need to do just the second one as following. Then submit zone file on the top right.
Step 3: Don't forget to set up your custom domain on Blogger. Setting=>Basic=>Publishing=>Edit
Done! After an hour or so, enter your custom domain, it will redirect to your Blogger's blog.
happy blogging...
Step 1: In this article, it mentioned a tool which can help you set it up quickly. After enter your own domain, once click confirm, DNS will be set it up automatically for Blogger.
http://nz.godaddy.com/blog/bloggerdnssetup.aspx?isc=bb2470
Step 2: Last step, Blogger will give you two CNAMEs to enter on GoDaddy, one is a common one (Name:www, Destination: ghs.google.com), another one is for your blog only. Previous tool will set up the common one on Godaddy, all you need to do just the second one as following. Then submit zone file on the top right.
Step 3: Don't forget to set up your custom domain on Blogger. Setting=>Basic=>Publishing=>Edit
Done! After an hour or so, enter your custom domain, it will redirect to your Blogger's blog.
happy blogging...
Subscribe to:
Posts (Atom)