Skip to content

Commit fe1ad18

Browse files
authored
REST API: Add POST /orders/order/{identifier}/shipments (#2292)
Add POST /orders/order/{identifier}/shipments Fix GET /orders/order/{identifier}/shipments
1 parent 1745096 commit fe1ad18

File tree

5 files changed

+624
-52
lines changed

5 files changed

+624
-52
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ShipmentCreate": {
3+
"identifier": "abc",
4+
"ShippingMethod": {
5+
"_media-type": "application/vnd.ibexa.api.ShippingMethod+json",
6+
"_href": "/api/ibexa/v2/shipping/methods/parcel_locker"
7+
},
8+
"Amount": {
9+
"value": "1922",
10+
"currency": "EUR"
11+
},
12+
"Owner": {
13+
"_media-type": "application/vnd.ibexa.api.User+json",
14+
"_href": "/api/ibexa/v2/user/users/14"
15+
},
16+
"Context": {
17+
"key1": "value1",
18+
"key2": "value2"
19+
}
20+
}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<ShipmentCreate>
3+
<identifier>abc</identifier>
4+
<ShippingMethod media-type="application/vnd.ibexa.api.ShippingMethod+json" href="/api/ibexa/v2/shipping/methods/parcel_locker"/>
5+
<Amount>
6+
<value>1922</value>
7+
<currency>EUR</currency>
8+
</Amount>
9+
<Owner media-type="application/vnd.ibexa.api.User+json" href="/api/ibexa/v2/user/users/14"/>
10+
<Context>
11+
<key1>value1</key1>
12+
<key2>value2</key2>
13+
</Context>
14+
</ShipmentCreate>

docs/api/rest_api/rest_api_reference/input/ez-orders.raml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,53 @@ displayName: Orders
7979
/shipments:
8080
get:
8181
displayName: Load shipments
82-
description: Loads a list of shipments.
82+
description: Loads a order's list of shipments.
8383
headers:
8484
Accept:
8585
description: If set, the shipments are returned in XML or JSON format.
8686
example: |
8787
application/vnd.ibexa.api.ShipmentRefList+xml
88-
Content-Type:
89-
description: The shipments schema encoded in XML or JSON format.
90-
example: |
91-
application/vnd.ibexa.api.ShipmentRefList+xml
9288
responses:
9389
200:
9490
description: OK - loads the shipments.
9591
body:
96-
application/vnd.ibexa.api.Shipment+xml:
97-
type: Shipment
92+
application/vnd.ibexa.api.ShipmentRefList+xml:
93+
type: ShipmentRefList
9894
example: !include examples/shipments/GET/ShipmentRefList.xml.example
99-
application/vnd.ibexa.api.Shipment+json:
100-
type: Shipment
95+
application/vnd.ibexa.api.ShipmentRefList+json:
96+
type: ShipmentRefList
10197
example: !include examples/shipments/GET/ShipmentRefList.json.example
10298
401:
103-
description: Error - the user has no permission to read shipment lists.
99+
description: Error - the user has no permission to read order's shipment lists.
104100
404:
105-
description: Error - the shipment does not exist.
101+
description: Error - the order does not exist.
102+
post:
103+
displayName: Create shipment
104+
description: Creates and adds a shipment to an order
105+
headers:
106+
Accept:
107+
description: If set, the shipments are returned in XML or JSON format.
108+
example: |
109+
application/vnd.ibexa.api.Shipment+xml
110+
application/vnd.ibexa.api.Shipment+json
111+
Content-Type:
112+
description: The shipments schema encoded in XML or JSON format.
113+
example: |
114+
application/vnd.ibexa.api.ShipmentCreate+xml
115+
application/vnd.ibexa.api.ShipmentCreate+json
116+
body:
117+
application/vnd.ibexa.api.ShipmentCreate+xml:
118+
type: ShipmentCreate
119+
example: !include examples/orders/POST/ShipmentCreate.xml.example
120+
application/vnd.ibexa.api.ShipmentCreate+json:
121+
type: ShipmentCreate
122+
example: !include examples/orders/POST/ShipmentCreate.json.example
123+
responses:
124+
200:
125+
description: Shipment is created and returned
126+
body:
127+
application/vnd.ibexa.api.Shipment+xml:
128+
type: Shipment
106129

107130
/{id}:
108131
get:

docs/api/rest_api/rest_api_reference/input/ez-types.raml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3783,6 +3783,26 @@ Shipment:
37833783
Method:
37843784
type: ShippingMethod
37853785

3786+
ShipmentRefList:
3787+
description: 'This class represents a list of Shipments'
3788+
type: object
3789+
properties:
3790+
shipmentRefList:
3791+
type: Shipment[]
3792+
3793+
ShipmentCreate:
3794+
description: 'This class represents the creation of a shipment.'
3795+
type: object
3796+
properties:
3797+
identifier:
3798+
type: string
3799+
ShippingMethod:
3800+
type: ShippingMethod
3801+
Owner:
3802+
type: User
3803+
Context:
3804+
type: object
3805+
37863806
ShipmentUpdate:
37873807
description: 'This class represents the update of a shipment.'
37883808
type: object

0 commit comments

Comments
 (0)