Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Use this resource to create site 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
nameName of the physical location.
instituteNameName of the institute which site is belongs to
coordinators

Collection of user object. User Info contains Login Name and Domain Name

type

Function of the site. It could be collection, storing, experimentation or it could be unspecified

{ collection site,repository,laboratory,not specified }

activityStatus

Defines the status of a site record

{active, closed, pending, disabled}

addressAddress of the site

 

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

Use this URL to add site in openSpecimen application.

Result:

The response of this request will contains the details of the created site.

Below is the example of the create site:

 

URLhttp://<host>:<port>/openspecimen/rest/ng/sites
MethodPOST
Requestapplication/json
json
Code Block
languagejs
themeEclipse
linenumberstrue
{
    "name": "Arkansas Hospital",
    "instituteName": "A1 - For Demo Users",
    "type": "Collection Site",
    "activityStatus": "Active",
    "coordinators":
    [
        {
            "loginName": "aalfortish",
            "domain": "openspecimen"
        },
        {
            "loginName": "vinod",
            "domain": "openspecimen"
        }
    ],
    "address": "Arkansas"
}

Response

Code Block
languagejs
themeEclipse
linenumberstrue
{
    "id": 4,
    "name": "Arkansas Hospital",
    "instituteName": "A1 - For Demo Users",
    "type": "Collection Site",
    "activityStatus": "Active",
    "cpCount": 0,
    "coordinators":
    [
        {
            "id": 107,
            "firstName": "Alexandra",
            "lastName": "Alfortish",
            "loginName": "aalfortish",
            "domain": "openspecimen",
            "emailAddress": "aalfortish@lcrc.info",
            "admin": false,
            "cpCount": 0,
            "creationDate": 1438021800000
        },
        {
            "id": 14,
            "firstName": "Vinod",
            "lastName": "Gaikwad",
            "loginName": "vinod",
            "domain": "openspecimen",
            "emailAddress": "vinod.gaikwad@domain.com",
            "admin": false,
            "cpCount": 0,
            "creationDate": null
        }
    ],
    "address": "Arkansas",
}

 

Error Cases :

code
Applies to
Status Message
200All resourcesSite has been created successfully
400All requestsInvalid parameters, e.g  duplicate Site Name, blank Site Name, blank Site Type etc
401All requestsAuthorization failed, user doesn't have Authority
500All requestsInternal server error, Encountered server error while performing operations