Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: SI: 1. Updated the page with correct JSON payloads. 2. Added 'CONTAINER' type shipment example. 3. Did some minor reformatting and grammerly changes.

Summary 

dThis page contains documentation of create shipment REST API. You can use URL: http[s]:<host>:<port>/catissuecoreopenspecimen/rest/ng/shipments  url

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: 

...

Barcode . Barcode must be unique.
ParameterDetails
labelDisplays label for nameName of the shipment. Label must be unique.barcode
type

Type of the shipment

specimenListIdentifierIdentifier of specimen list which is shipping.
senderSiteSender site name.
receiverSiteReceiver site name.
senderContactPersonSender's user name
receiverContactPersonReceivers user name
sendDateDate of shipping
courierNameCourier name of which shipping sent.
courierTrackingIdCourier tracking identifier for a shipment.
courierTrackingUrlCourier Tracking url.
activityStatusActivity status of shipment. Permissible values are {In Progress, Received, Rejected }

Response :

Response of this event contains details of newly created shipment.

 

(Optional). Permissible values are {'SPECIMEN', 'CONTAINER'}


courierNameCourier name of which shipping sent (Optional).
trackingNumberCourier tracking number for a shipment (Optional).
trackingUrlCourier tracking URL (Optional).
sendingSiteSender site name.
receivingInstituteReceiving institute name (Optional).
receivingSiteReceiver site name.
notifyUsersCollection of users to be notified (Optional).
shippedDateDate of shipping (Optional).
senderCommentsSender comments (Optional).
statusStatus of shipment (Optional). Permissible values are {'Pending', 'Shipped'}
senderCommentsComments from the sender of the shipment (Optional).
shipmentSpmns

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

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

Example:

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

Expand


...

openspecimen/rest/ng/shipments
MethodPOST
Content-Typeapplication/

...

JSON
Request

...


Code Block
languagejs
collapsetrue
{
  "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


Code Block
languagejs
collapsetrue
{
  "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:

Expand


URLhttp://<host>:<port>/openspecimen/rest/ng/shipments
MethodPOST
Content-Typeapplication/JSON
Request


Code Block
languagejs
collapsetrue
{
  "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


Code Block
languagejs
collapsetrue
{
  "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
200All resourcesShipment The shipment has been created successfully.
400All requestsInvalid parameters, e.g Invalid Users, Invalid Specimen-List id, Null or empty label, barcode.
401All requestsAuthorization failed, User doesn’t have Authority.
500All requestsInternal server error, Encountered server error while performing operations.