Skip to content

Commit 70606f9

Browse files
committed
Structured Content
1 parent 3e08a9b commit 70606f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1786
-8
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Design Principles
2+
3+
To compare the interface design approaches of SOAP-based web services to those of REST services, the former tend to be centered around operations that are usually use-case specific and reveal service implementation details (inside-out perspective). This leads to closely coupled systems which tend to get brittle and fragile as complexity grows. In contrast, REST is all about (business) entities found in the system and exposed as resource endpoints — leading to interfaces which abstract away implementation details (outside-in perspective) and are thereby more broadly usable and longer lasting. .
4+
5+
## API Design Principles
6+
7+
1. We prefer REST-based APIs
8+
2. We prefer systems to be truly RESTful
9+
3. We strive to build interoperating distributed systems that different teams can evolve in parallel
10+
11+
An important principle for (RESTful) API design and usage is Postel's Law, aka [the
12+
Robustness Principle](http://en.wikipedia.org/wiki/Robustness_principle) (RFC 1122):
13+
14+
> “Be liberal in what you accept, be conservative in what you send.”
15+
16+
The ability to extend service definitions after the initial release without affecting already deployed clients is key to preserve agility and evolvability of those services. For a more in-depth discussion regarding its applicability on API Design, please read the [Message Schema and Postel's Law](../message-schema/message-schema.md) chapter.
17+
18+
Read the following to gain additional insight on the RESTful service architecture paradigm and general RESTful API design style:
19+
20+
* Fielding Dissertation: [Architectural Styles and the Design of Network-Based Software
21+
Architectures](http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm)
22+
* Book: [REST in Practice: Hypermedia and Systems
23+
Architecture](http://www.amazon.de/REST-Practice-Hypermedia-Systems-Architecture/dp/0596805829)
24+
* Book: [A Practical Approach to API Design](https://leanpub.com/restful-api-design)
25+
* Book: [Build APIs You Won't
26+
Hate](https://leanpub.com/build-apis-you-wont-hate)
27+
* InfoQ eBook: [Web APIs: From Start to
28+
Finish](http://www.infoq.com/minibooks/emag-web-api)
29+
* Lessons-learned blog: [Thoughts on RESTful API
30+
Design](http://restful-api-design.readthedocs.org/en/latest/)
31+
32+
We apply the RESTful web service principles to all kind of application components, whether they provide functionality via the Internet or via the intranet as larger application elements. We strive to build interoperating distributed systems that different teams can evolve in parallel.
33+
34+
---
35+
This chapter was adopted from the [Zalando API Styleguide](https://github.com/zalando/restful-api-guidelines/blob/master/Introduction.md)

api-guidelines/api-design-process/api-design-process.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## API Modelling and Design Process
2+
3+
The following API Modelling Process has been excerpted from chapter 4 and chapter 6 of [A Practical Approach to API Design](https://leanpub.com/restful-api-design) by D. Keith Casey Jr and James Higginbotham. (**This is just a brief summary for educational purpose - please consider buying the book to support their excellent work**)
4+
5+
### API Modelling Process
6+
API modeling consists of 5 activities that help identify the requirements of your API design:1. Identify the participants, or actors, that will interact with your API2. Identify the activities that participants wish to achieve3. Separate the activities into steps that the participants will perform4. Create a list of API methods from the steps, grouped into common resource groups5. Validate the API by using scenarios to test the completeness of the APIThe goal of each step is to explore the requirements of the API from a variety of different perspectives: those involved (the participants), what they want to do (the activities), and how they will complete an activity (the steps). The modeling process will be iterative, so it should be expected that each modeling activity may require that you revisit the previous step as previously hidden details are exposed.
7+
### API Design Process
8+
As you move from the modeling to the design phase, you will be faced with a variety of decisions. Some of these will resolve easily, while others will take time and deliberation. Just know that it is difficult to get your API design right the first time. This is why we encourage you to spend time designing and prototyping your API before you start implementing it.
9+
10+
#### Building Your Resource Taxonomy
11+
To get started building your taxonomy, make a list of the resources you have modeled already. These are often identified as the nouns in your system. Keep in mind that some resources may belong as a child collection of another resource.
12+
13+
#### How to Handle Resource Relationships and Composition
14+
Resources often contain child resources or reference other resources. In these cases, the API design must ensure that one can interact with the top-level resource as well as nested and related resources.To better design our API, we need to understand the three types of resource relationships:
15+
Relationship | Description--------------|-------------
16+
Independent | The resources exist stand alone without the other’s existence, but may reference each other
17+
Dependent | One resource cannot exist without the existence of the parent resource
18+
Associative | The resources exist independently, however their relationship contains or requires additional properties to describe it
19+
How you design your API around related resources can be determined based on a few questions. The answers to these questions will determine if your resources are independent, dependent, or associative:
20+
1. Can both resources exist without the other? Then we have an ***Independent*** resource2. Does one resource exist only when the other exists? Then we have a ***Dependent*** resource3. Does the relationship between resources require more state than just the links between them? Then we have an ***Associative*** resource
21+
#### Defining Resource LifecyclesOnce we have identified our RESTful API resources, it is time to start mapping them to our HTTP verbs. During the API Modelling Process, we were able to capture most activities using a specific list of actions: “list”, “clear”, “view”, etc. Depending on the verbs you commonly use during modeling, you will likely find that certain ones can be mapped directly to REST patterns.#### Mapping Response Codes For Success and Failure
22+
Please see [HTTP Status Codes](../http-status-codes/http-status-codes.md) for a more in depth discussion.#### Expanding Resources Through Hypermedia LinkingAs you move from resource identification, it is time to explore the links (relationships) each resource will provide. Resource links are just like links within a web page - they describe the options available for navigation. Links may be used for a variety of reasons:
23+
1. To inform clients about the actions available given the resource’s current state2. Provide hints to actions that are authorized for the current user
24+
3. Allow clients to explore resource relationships
25+
26+
The following is a quick summary of Hypermedia Linking
27+
28+
* ***Link Thyself***: Every resource should define a link to itself. While this seems to be redundant, or perhaps wasteful, there is a valid reason for returning a link to a returned resource: clients should never have to track the link that returned a resource separate from the resource representation itself.
29+
* ***Resource State Linking***: Look for any constraints and state transitions that a resource may require. These constraints should be surfaced as links, offering insight into what actions are allowed and not allowed given the current state of a resource.
30+
* ***Relationship Linking***: Resources should include links to a parent resource, children, or related resources as identified during the previous taxonomy step.
31+
* ***Additional Navigation Links***: Most commonly used for collection responses, where you may need to offer pagination links for next and previous pages, and for navigation to other areas of the API.
32+
33+
Please see [Hypermedia and Rest](../hypermedia-and-rest/hypermedia-and-rest.md) for a more in depth discussion of Hypermedia.
34+
35+
---
36+
37+
A good reference book for APIs and API Design is the afore mentioned [A Practical Approach to API Design](https://leanpub.com/restful-api-design) by D. Keith Casey Jr and James Higginbotham.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
## API Design Review Process
2+
3+
### Why
4+
We believe in APIs and in the API Economy. We are just at the beginning of our journey to an API driven company. There is no clear roadmap how to reach our goal. For sure it will be ways in which we stumble, sometimes fail but hopefully succeed in the end.
5+
6+
There will be pros and cons how to handle and apply the style guide to real projects. There are many things to learn and to share with another. We have to keep improving the style guide, review process, and tools to capture our evolving knowledge and experience.
7+
8+
To formalize the learning process we decided to establish the **API Design Review Process**. Each new or refactored API MUST be reviewed through this process.
9+
10+
### Feedback
11+
We have now done a couple of API design reviews. Please give us feedback how we can improve this process!
12+
13+
### Review process
14+
15+
#### Who is responsible for scheduling the review?
16+
A representative of the project team that creates the service MUST contact the CTO office. In most cases the representative is the API designer/architect.
17+
18+
#### How to plan the review?
19+
It is the responsibility of the team to plan their resources for the API review and to talk with the team leaders of CTO office to organize reviewers. Together they decide on the appropriate time box for the review.
20+
21+
#### Tooling
22+
Currently we use a **private GitHub repo** for each API review.
23+
The `README.md` should contain the following informations:
24+
25+
- Purpose of the API
26+
- Links to the API description
27+
- Start date of the review
28+
- End date of the review
29+
- Mandatory reviewers including state
30+
- State of the review itself
31+
- Conclusion
32+
33+
#### API description
34+
It is necessary to provide a formal description of the API to review it.
35+
The API designer has to provide a Swagger description (prefered) or an equivalent description. Providing a running system or a mock to work with the API is highly appreciated.
36+
37+
#### Reviewing the API
38+
It is up to the API designer and reviewer how to perform the review. It is a good idea to schedule a meeting and step through the API and talk with the reviewers about the functionality and intention. That's a good way to cut down review times because questions and missunderstandings can be solved immediately. Others prefer to review the API without a formal meeting.
39+
40+
Changes requests are stored as issues in the GitHub repo.
41+
Each reviewer has to update his personal review state in GitHub.
42+
43+
#### Mandatory vs optional reviewers
44+
During the review planning at least two reviewers will be fixed.
45+
The mandatory reviewers are explicitly named in the GitHub review repo.
46+
47+
Each review is open for feedback from a wide group of other people.
48+
That includes all interested architects, team members, and clients that will use the API. The CTO office informs - per default - all architects on pending reviews. The team is free to add optional reviewers of its own.
49+
50+
#### How issues should be raised and addressed
51+
We use the GitHub issue mechanism for a transparent communication during the review. Each issue must be categorized as follows:
52+
53+
- Must change: Must be changed in the API design and implementation
54+
- Improvement: Should be changed. Depends on the team
55+
- Question: For Questions/Discussions and clarifications
56+
57+
Please use Github labels for the classification.
58+
59+
#### Time boxed reviews
60+
The review is time boxed. It starts at a given date and - more importantly - it ends at a predefined date. The outcome of the review is documented in the GitHub repo `README.md`.
61+
62+
#### When is an API reviewed and can be implemented?
63+
After finishing the API review there will be some change requests for the API.
64+
Most of them might be easy to fix/change and the API designer should do that immediately during and after the review. Other changes may need more effort and planning how to address them.
65+
66+
The next steps and the the conclusion how to proceed with the change requests is written down in the **conclusion** section of the GitHub repo `README.md`.
67+
The implementation can start after finishig the review.
68+
69+
#### Learnings from the review and feedback to the style guide
70+
After each review the API designer/team should provide a feedback issue in the
71+
API style guide project and mark it with the label **feedback**.
72+
The feedback has to cover at least the topics
73+
74+
- How helpful was the API style guide for your design process?
75+
- Which sections especially?
76+
- What did you learn for future API designs?
77+
- How to improve the style guide itself?
78+
- Which information do you miss?
79+
- Which guideline do you not agree with?
80+
- How to improve the API review process itself?
81+
- What can we improve regarding tooling, planning etc.
82+
83+
#### How to measure success for the API review
84+
There are two goals in an API review
85+
86+
##### Improve the API itself
87+
It's not that easy to measure the improvement of the API. It is best to look at it from a client perspective. How costly (in time and effort) is the programming against the API for a developer? Can you quantify it and imporve on the KPI?
88+
89+
##### Learn to design APIs
90+
This is even harder to measure than the one above. If you can think of a good way to measure our ability to continously improve our API Deisgn skills and processes, we would love to hear it.

0 commit comments

Comments
 (0)