Create Shipment
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Create Shipment

URL: http[s]:<host>:<port>/openspecimen/rest/ng/shipments

Use this URL to create a shipment in the OpenSpecimen application. Use HTTP POST method to call this API by passing the below details in JSON format

Below are the attributes which need to be sent in the request body: 

Parameter

Details

Parameter

Details

name

Name of the shipment.

type

Type of the shipment (Optional). Permissible values are {'SPECIMEN', 'CONTAINER'}

courierName

Courier name of which shipping sent (Optional).

trackingNumber

Courier tracking number for a shipment (Optional).

trackingUrl

Courier tracking URL (Optional).

sendingSite

Sender site name.

receivingInstitute

Receiving institute name (Optional).

receivingSite

Receiver site name.

notifyUsers

Collection of users to be notified (Optional).

shippedDate

Date of shipping (Optional).

senderComments

Sender comments (Optional).

status

Status of shipment (Optional). Permissible values are {'Pending', 'Shipped'}

senderComments

Comments from the sender of the shipment (Optional).

shipmentSpmns

Collection of specimens to be shipped. When the shipment type is 'SPECIMEN'.

shipmentContainers

Collection of shipments to be shipped. When the shipment type is 'CONTAINER'.

Example:

#1 Below is an example of creating a 'SPECIMEN' type shipment:

URL

http://<host>:<port>/openspecimen/rest/ng/shipments

Method

POST

Content-Type

application/JSON

Request

{ "status":"Shipped", "type":"SPECIMEN", "shipmentSpmns":[ { "specimen":{ "label":"TCP_TBS_4.D1.A8" } }, { "specimen":{ "label":"TCP_TBS_4.D1.A9" } }, { "specimen":{ "label":"TCP_TBS_4.D1.A10" } } ], "shipmentContainers":[], "sendingSite":"Pune Site", "shippedDate":"2020-06-08T10:15:28.613Z", "notifyUsers":[ { "emailAddress":"dr.swapnilingle1@gmail.com" } ], "name":"Shipment to AR Site (#1001)", "courierName":"FedEx", "trackingNumber":"FedExTrkNum1001", "trackingUrl":"https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=FedExTrkNum1001&cntry_code=IND", "receivingInstitute":"USB", "receivingSite":"Applied Research", "senderComments":"Handle with care" }

Response

{ "id": 8, "name": "Shipment to AR Site (#1001)", "type": "SPECIMEN", "courierName": "FedEx", "trackingNumber": "FedExTrkNum1001", "trackingUrl": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=FedExTrkNum1001&cntry_code=IND", "sendingSite": "Pune Site", "receivingInstitute": "USB", "receivingSite": "Applied Research", "shippedDate": 1591611328613, "sender": { "id": 2, "type": "SUPER", "firstName": "System", "lastName": "Administrator", "loginName": "admin", "domain": "openspecimen", "emailAddress": "admin@localhost", "instituteName": "USB", "primarySite": "Site BO 1", "admin": true, "instituteAdmin": false, "manageForms": true, "cpCount": 0, "creationDate": null, "activityStatus": "Active" }, "senderComments": "Handle with care", "receivedDate": null, "receiver": null, "receiverComments": null, "status": "Shipped", "activityStatus": "Active", "shipmentSpmns": [], "shipmentContainers": [], "notifyUsers": [ { "id": 11, "type": "NONE", "firstName": "Daniella", "lastName": "Winchester", "loginName": "DaniellaW", "domain": "openspecimen", "emailAddress": "dr.swapnilingle1@gmail.com", "instituteName": "USB", "primarySite": "Applied Research", "admin": false, "instituteAdmin": false, "manageForms": false, "cpCount": 0, "creationDate": 1579631400000, "activityStatus": "Locked" } ], "specimensCount": null, "request": null, "shipmentSpecimen": null, "shipmentContainer": null, "sendMail": true, "mergeKey": "Shipment to AR Site (#1001)" }

#2 Below is an example of creating a 'CONTAINER' type shipment:

URL

http://<host>:<port>/openspecimen/rest/ng/shipments

Method

POST

Content-Type

application/JSON

Request

{ "status":"Shipped", "type":"CONTAINER", "shipmentSpmns":[], "shipmentContainers":[ { "container":{ "name":"Pune Site (Virtual).B1" } }, { "container":{ "name":"Pune Site (Virtual).B2" } } ], "shippedDate":"2020-06-08T10:47:04.155Z", "notifyUsers":[ { "emailAddress":"admin@localhost" } ], "name":"Container Shipment #2", "courierName":"FedEx", "trackingNumber":"FedExNum2002", "trackingUrl":"https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=FedExNum2002&cntry_code=IND", "sendingSite":"Pune Site", "receivingInstitute":"USB", "receivingSite":"Applied Research", "senderComments":"Containers sent on 08-06-2020" }

Response

{ "id": 13, "name": "Container Shipment #2", "type": "CONTAINER", "courierName": "FedEx", "trackingNumber": "FedExNum2002", "trackingUrl": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=FedExNum2002&cntry_code=IND", "sendingSite": "Pune Site", "receivingInstitute": "USB", "receivingSite": "Applied Research", "shippedDate": 1591613224155, "sender": { "id": 2, "type": "SUPER", "firstName": "System", "lastName": "Administrator", "loginName": "admin", "domain": "openspecimen", "emailAddress": "admin@localhost", "instituteName": "USB", "primarySite": "Site BO 1", "admin": true, "instituteAdmin": false, "manageForms": true, "cpCount": 0, "creationDate": null, "activityStatus": "Active" }, "senderComments": "Containers sent on 08-06-2020", "receivedDate": null, "receiver": null, "receiverComments": null, "status": "Shipped", "activityStatus": "Active", "shipmentSpmns": [], "shipmentContainers": [], "notifyUsers": [ { "id": 2, "type": "SUPER", "firstName": "System", "lastName": "Administrator", "loginName": "admin", "domain": "openspecimen", "emailAddress": "admin@localhost", "instituteName": "USB", "primarySite": "Site BO 1", "admin": true, "instituteAdmin": false, "manageForms": true, "cpCount": 0, "creationDate": null, "activityStatus": "Active" } ], "specimensCount": null, "request": null, "shipmentSpecimen": null, "shipmentContainer": null, "sendMail": true, "mergeKey": "Container Shipment #2" }

 

Error Cases

code

Applies to

Status Message

code

Applies to

Status Message

200

All resources

The shipment has been created successfully.

400

All requests

Invalid parameters, e.g Invalid Users, Invalid Specimen-List id, Null or empty label, barcode.

401

All requests

Authorization failed, User doesn’t have Authority.

500

All requests

Internal server error, Encountered server error while performing operations.

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com