You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/org.restlet.tutorial.webapi/README.md
+20-31Lines changed: 20 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,12 @@
6
6
7
7
* Git installed on your machine
8
8
9
-
> The implementation is located [here](https://github.com/restlet/restlet-tutorial/tree/master/modules/org.restlet.tutorial.webapi)
10
-
> You can clone this repository; the source code is located in `/modules/org.restlet.tutorial.webapi/` folder.
9
+
The implementation is located [here](https://github.com/restlet/restlet-tutorial/tree/master/modules/org.restlet.tutorial.webapi). You can clone this repository; the source code is located in `/modules/org.restlet.tutorial.webapi/` folder.
11
10
12
-
> This example uses [Restlet Framework 2.3.0](http://restlet.com/download/current) (Java SE edition)
13
-
and [H2 Database](www.h2database.com)
11
+
This example uses [Restlet Framework 2.3.0](http://restlet.com/download/current) (Java SE edition)
12
+
and [H2 Database](www.h2database.com).
14
13
15
-
> Restlet Framework's User Guide is available [here](http://restlet.com/technical-resources/restlet-framework/guide/2.3/).
14
+
Restlet Framework's User Guide is available [here](http://restlet.com/technical-resources/restlet-framework/guide/2.3/).
16
15
17
16
## Installation
18
17
@@ -23,7 +22,7 @@ To install the Maven project:
23
22
* Execute `mvn clean install`
24
23
* For eclipse users : run `mvn eclipse:eclipse`
25
24
26
-
> For further instruction about running a Maven project : [Building a project with Maven](http://maven.apache.org/run-maven/index.html)
25
+
For further instruction about running a Maven project : [Building a project with Maven](http://maven.apache.org/run-maven/index.html)
27
26
28
27
### Run this application
29
28
@@ -42,11 +41,9 @@ To simplify the launch of the application, authentication and authorization are
42
41
* owner/owner : to get owner role
43
42
* user/user : to get user role
44
43
45
-
It uses HTTP Basic authentication.
44
+
It uses HTTP Basic authentication. Learn more about authentication, authorization and security with Restlet Framework [here](http://restlet.com/learn/guide/2.3/core/security/).
46
45
47
-
> Learn more about authentication, authorization and security with Restlet Framework [here](http://restlet.com/learn/guide/2.3/core/security/).
48
-
49
-
> You can try this application easily with a REST client like [POSTMAN](http://www.getpostman.com/).
46
+
You can try this application easily with a REST client like [POSTMAN](http://www.getpostman.com/).
50
47
51
48
## Database access
52
49
@@ -55,15 +52,14 @@ To visualize the database, open the H2 console in you browser (`http://localhost
55
52
## Description
56
53
57
54
This Web API contains 2 main resources :
58
-
59
55
* Company : identified by an auto-generated id.
60
56
* Contact : identified by its email. A contact can be part of a company and get a reference to it.
> A Web API definition can be generated with [APISpark extension (RF 2.3)](http://restlet.com/learn/guide/2.3/extensions/apispark).
62
+
A Web API definition can be generated with [APISpark extension (V2.3)](http://restlet.com/learn/guide/2.3/extensions/apispark).
67
63
68
64
## Implementation choices
69
65
@@ -76,7 +72,6 @@ This is a diagram of the API :
76
72
## Next steps
77
73
78
74
Here are some instructions to go further with this project:
79
-
80
75
* Persistence layer
81
76
* For each operation a new connection is created.
82
77
It would be useful to use a connection pool like [DBCP](http://commons.apache.org/proper/commons-dbcp/) or the built-in connection pool of your database's JDBC driver if available.
@@ -92,7 +87,7 @@ Here are some instructions to go further with this project:
92
87
93
88
## Usage
94
89
95
-
> These examples are made using the JSON format but you can use XML or YAML if you want.
90
+
These examples are made using the JSON format but you can use XML or YAML if you want.
96
91
97
92
### Ping resource
98
93
@@ -102,7 +97,7 @@ A resource `/ping` has been created which does not need authentication.
102
97
103
98
It should return the ```Version: 1.0.0 running``` text in the HTTP response body.
104
99
105
-
> For the following examples, Basic Authentication is required
100
+
For the following examples, Basic Authentication is required.
106
101
107
102
### Create a company
108
103
@@ -121,17 +116,15 @@ It should return the ```Version: 1.0.0 running``` text in the HTTP response body
121
116
}
122
117
```
123
118
124
-
> The returned status is : `201 Created`.
125
-
126
-
NOTE: the location of the created company is written is the "Location" HTTP header.
119
+
The returned status is : `201 Created`. Note that the location of the created company is written is the "Location" HTTP header.
127
120
128
121
### Retrieve all created companies
129
122
130
123
```GET http://localhost:9000/v1/companies/```
131
124
132
125
> The trailing slash is optional : both `http://localhost:9000/v1/companies/` and `http://localhost:9000/v1/companies` will work.
133
126
134
-
It should retrieve :
127
+
It should retrieve :
135
128
136
129
```json
137
130
{
@@ -163,16 +156,15 @@ NOTE: the location of the created company is written is the "Location" HTTP head
163
156
}
164
157
```
165
158
166
-
> The `self` element refers to the location of the object : `http://localhost:9000/v1/companies/3`.
with `{email}` representing the email of the contact you want to insert.
165
+
with `{email}` representing the email of the contact you want to insert.
174
166
175
-
For this example, it is:
167
+
For this example, it is:
176
168
``` PUT http://localhost:9000/v1/contacts/gblondeau@restlet.com```
177
169
178
170
```json
@@ -196,18 +188,15 @@ You should get back:
196
188
}
197
189
```
198
190
199
-
> The returned status is : `201 Created`.
191
+
The returned status is : `201 Created`.
200
192
201
-
> The property company is a reference to the location of the company, with 1 the id of the company.
202
-
ie : /companies/1 refers to http://localhost:9000/v1/companies/1
193
+
The property company is a reference to the location of the company, with 1 the id of the company. ie : /companies/1 refers to http://localhost:9000/v1/companies/1
203
194
204
195
### Retrieve the list of created contacts
205
196
206
197
```GET http://localhost:9000/v1/contacts```
207
198
208
-
> The trailing slash is optional : both ```http://localhost:9000/v1/contacts/``` and ```http://localhost:9000/v1/contacts``` will work.
209
-
210
-
It should retrieve :
199
+
The trailing slash is optional : both ```http://localhost:9000/v1/contacts/``` and ```http://localhost:9000/v1/contacts``` will work. It should retrieve :
211
200
212
201
```json
213
202
{
@@ -225,7 +214,7 @@ It should retrieve :
225
214
}
226
215
```
227
216
228
-
> The property company is a reference to the location of the company
217
+
The property company is a reference to the location of the company.
229
218
230
219
To display the company information, add the following query parameter : ```?strategy=load```
231
220
@@ -284,4 +273,4 @@ It should retrieve:
284
273
}
285
274
```
286
275
287
-
> This time a ```200 OK ``` is returned because it is not a creation but an update.
276
+
This time a ```200 OK ``` is returned because it is not a creation but an update.
0 commit comments