Skip to content

Latest commit

 

History

History
198 lines (152 loc) · 4.55 KB

Pacco-sample-scenario.rest

File metadata and controls

198 lines (152 loc) · 4.55 KB

@api = http://localhost:5000

### At first, create an account POST {{api}}/identity/sign-up Content-Type: application/json

{
"email": "pacco-user1@mailinator.com", "password": "secret", "role": "user"

}

### Authenticate and grab the access token # @name sign_in POST {{api}}/identity/sign-in Content-Type: application/json

{
"email": "pacco-user1@mailinator.com", "password": "secret"

}

### Get your user account details @accessToken = {{sign_in.response.body.$.accessToken}} GET {{api}}/identity/me Authorization: Bearer {{accessToken}}

### Complete the customer registration process POST {{api}}/customers Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"fullName": "John Doe", "address": "New York"

}

### Get your customer account details GET {{api}}/customers/me Authorization: Bearer {{accessToken}}

### Add a parcel and grab its id # @name add_parcel POST {{api}}/parcels Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"variant": "weapon", "size": "large", "name": "Parcel #1", "description": "My parcel #1"

}

### Get your parcels @parcelId = {{add_parcel.response.headers.Resource-ID}} GET {{api}}/parcels Authorization: Bearer {{accessToken}}

### Calculate the parcel volume to see whether it works as expected GET {{api}}/parcels/volume?parcelIds=["{{parcelId}}"] Authorization: Bearer {{accessToken}}

### Create a new order and grab its id # @name create_order POST {{api}}/orders Authorization: Bearer {{accessToken}} Content-Type: application/json

{

### Get your orders @orderId = {{create_order.response.headers.Resource-ID}} GET {{api}}/orders Authorization: Bearer {{accessToken}}

### Add a parcel to the order POST {{api}}/orders/{{orderId}}/parcels/{{parcelId}} Authorization: Bearer {{accessToken}} Content-Type: application/json

{

### Get your order details which should now contain a package GET {{api}}/orders/{{orderId}} Authorization: Bearer {{accessToken}}

### Add a new vehicle # @name add_vehicle POST {{api}}/vehicles Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"brand": "Brand", "model": "Model", "description": "Vehicle description", "payloadCapacity": 1000, "loadingCapacity": 1000, "pricePerService": 100, "variants": 1

}

### Get a newly added vehicle @vehicleId = {{add_vehicle.response.headers.Resource-ID}} GET {{api}}/vehicles?payloadCapacity=0&loadingCapacity=0&variants=1 Authorization: Bearer {{accessToken}}

### Add a vehicle as the available resource being able to deliver the pacakge @resourceId = {{add_vehicle.response.headers.Resource-ID}} @tags = ["vehicle", "armor"]

POST {{api}}/availability/resources Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"resourceId": "{{resourceId}}", "tags": {{tags}}

}

### Browse the resources filtered by tags if needed GET {{api}}/availability/resources?tags={{tags}}&matchAllTags=false Authorization: Bearer {{accessToken}}

### Assign a vehicle to your order and set the desired delivery date @deliveryDate = 2020-01-10

POST {{api}}/orders/{{orderId}}/vehicles/{{vehicleId}} Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"deliveryDate": "{{deliveryDate}}"

}

### Make a reservation for the given date to deliver the package POST {{api}}/availability/resources/{{resourceId}}/reservations/{{deliveryDate}} Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"priority": 0

}

### Ensure that resource was reserved for the chosen date GET {{api}}/availability/resources/{{resourceId}} Authorization: Bearer {{accessToken}}

### Start the delivery and grab its id # @name start_delivery POST {{api}}/deliveries Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"orderId": "{{orderId}}", "description": "Delivery description", "dateTime": "{{deliveryDate}}"

}

### Add some internal delivery transportation details @deliveryId = {{start_delivery.response.headers.Resource-ID}} POST {{api}}/deliveries/{{deliveryId}}/registrations Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"id": "{{deliveryId}}", "description": "Delivery registration description", "dateTime": "{{deliveryDate}}"

}

### Complete the delivery POST {{api}}/deliveries/{{deliveryId}}/complete Authorization: Bearer {{accessToken}} Content-Type: application/json

{
"id": "{{deliveryId}}"

}

### Check the delivery details GET {{api}}/deliveries/{{deliveryId}} Authorization: Bearer {{accessToken}}

### Get your order details which should now be marked as completed GET {{api}}/orders/{{orderId}} Authorization: Bearer {{accessToken}}