1. Order REST API
1.1. General Jeeshop REST principles
1.1.1. Methods
Method | Operations |
---|---|
GET |
Get a single resource or get a collection of resources. |
POST |
Create a new resource. |
PUT |
Update properties of an existing resource. |
DELETE |
Delete an existing resource. |
HEAD |
Check authentication credentials. (Only available on User resource) |
The media-type of HTTP requests should be set to application/json.
The media-type of HTTP responses is always application/json unless binary content is requested (eg. deployment resource data), the media-type of the content is used.
Items relationships are always lazy loaded and must be explicitly requested to get them. (they are not eagerly fetched)
1.1.2. Authentication and authorization
Jeeshop REST API operations are protected by role based access. Therefore, most of REST operations require authentication.
Jeeshop authentication and authorization are managed using JaaS. See this documentation for details about Jeeshop JaaS configuration on Wildfly application server.
Currently, only Basic HTTP access authentication is documented, so you should include a Authorization: Basic ...== HTTP-header when performing requests to API methods which are not public.
For security purpose we only allow Basic Authentication in combination with HTTPS. See this documentation for details about Jeeshop SSL configuration on Wildfly application server. |
Each REST operation documentation declares one or many roles which are required for method use :
-
admin - Role dedicated to admin / back office operations. (Typically, it has to be set on Jeeshop administrators accounts for Jeeshop-Admin application use)
-
user - Default role bound to Jeeshop users. (Every online store registered users have this role)
-
ALL - Public. Methods which declare this role are public. Authentication is not required for their use.
1.2. Order resource
Manages user orders.
1.2.1. Get user/all orders
URL |
/rs/orders |
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method |
GET |
|||||||||||||||||||||||||||
Roles allowed |
admin,user |
|||||||||||||||||||||||||||
Parameters |
|
|||||||||||||||||||||||||||
Response HTTP statuses |
|
|||||||||||||||||||||||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/Order.list.json.adoc[] |
1.2.2. Get orders count
URL |
/rs/orders/count |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method |
GET |
||||||||||||
Roles allowed |
admin |
||||||||||||
Parameters |
|
||||||||||||
Response HTTP statuses |
|
||||||||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/order_count.json.adoc[] |
1.2.3. Get a specific order
URL |
/rs/orders/[id] |
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Method |
GET |
|||||||||
Roles allowed |
admin, user |
|||||||||
Parameters |
|
|||||||||
Response HTTP statuses |
|
|||||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/order.json.adoc[] |
1.2.4. Get fixed delivery fee configuration
URL |
/rs/orders/fixeddeliveryfee |
||||
---|---|---|---|---|---|
Method |
GET |
||||
Roles allowed |
admin |
||||
Response HTTP statuses |
|
||||
Response Body |
Unresolved directive in <stdin> - include::snippets/order.fixeddeliveryfee.json.adoc[] |
1.2.5. Create an order
URL |
/rs/orders |
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Method |
POST |
|||||||||
Description |
Create provided order and performs operations such as validation, pricing, payment triggering … See user guide (TODO) for details |
|||||||||
Roles allowed |
admin, user For user role, this order will be bound to current authenticated user. |
|||||||||
Parameters |
|
|||||||||
Request Body |
Unresolved directive in <stdin> - include::snippets/order.in.json.adoc[] |
|||||||||
Response HTTP statuses |
|
|||||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/user.json.adoc[] |
1.2.6. Modify an order
URL |
/rs/users |
||||||
---|---|---|---|---|---|---|---|
Method |
PUT |
||||||
Roles allowed |
admin |
||||||
Parameters |
|
||||||
Request Body |
Unresolved directive in <stdin> - include::snippets/order.json.adoc[] |
||||||
Response HTTP statuses |
|
||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/order.json.adoc[] |
1.3. Eligible order discounts resource
Manages user orders.
1.3.1. Get eligible order discounts
URL |
/rs/discounts/eligible |
||||||
---|---|---|---|---|---|---|---|
Method |
GET |
||||||
Description |
Returns all discounts eligible for current authenticated user’s next order. |
||||||
Roles allowed |
user |
||||||
Parameters |
|
||||||
Response HTTP statuses |
|
||||||
Response Body |
Unresolved directive in <stdin> - include::snippets/Discount.list.json.adoc[] |