Wiki

Clone wiki

dtn-nwatch / Admin Routes

Admin Routes

GET - /admin/samples/labs

POST - /admin/samples/labs

PUT - /admin/samples/labs/{id}

GET - /admin/samples/list

GET - /admin/samples/list.json

GET - /admin/samples/review

GET - /admin/samples/review.json

GET - /admin/samples/takers

POST - /admin/samples/takers

PUT - /admin/samples/takers/{id}

GET - /admin/samples/update.json

POST - /admin/samples/update.json

GET - /admin/samples/labs

This route handles a GET request and returns a list of SampleLabs records to the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the list of SampleLabs, that should respect the following schema:
    #!json
    {
        "labs": [
            {
                "id": "[\d]{1, 11}",
                "name": "[.]{1, 64}",
                "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
                "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}",
                "idLocation": "[\d]{1, 11}",
                "active": "[0-1]{1}"
            },
            ....
        ]
    }
    

cURL

#!bash
curl -X GET -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" "http://192.168.99.100:8087/admin/samples/labs" 

Back to the top

POST - /admin/samples/labs

This route handles a POST request and returns the newly created SamplesLabs record to the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8",
        "required": true
    }
    

Body Parameters

  • body is dependent on the Content-Type of the Request Header. When the Content-Type is set to application/json the JSON equivalent of a SampleLabs record should be sent that should respect the following schema:
    #!json
    {
        "name" :"[.]{1, 64}", 
        "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}", 
        "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}",
        "line1": "[.]{1, 64}", 
        "city": "[.]{1, 64}", 
        "state":"[A-Z]{2}", 
        "zip5":"\d{5, 11}"
    }
    
    When the Content-Type is set to application/x-www-form-urlencoded a Parameter Key/Value pair string of parameters should be sent that should respect the following schema:
    name=[.]{1, 64}&email=[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}&phoneNumber=[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}&line1=[.]{1, 64}&city=[.]{1, 64}&state=[A-Z]{2}&zip5=\d{5, 11}
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the SampleLab that was created, that should respect the following schema:
    #!json
    {
        "lab": {
            "id": "[\d]{1, 11}",
            "name": "[.]{1, 64}",
            "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
            "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}",
            "idLocation": "[\d]{1, 11}",
            "active": "[0-1]{1}"
        }
    }
    

cURL

#!bash
curl -X "POST" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "Content-Type: application/json" -d '{"name": "Poovey Labs", "email": "pammykins@poovey.com", "line1": "123 Fifth Avenue", "city": "New York", "state": "NY", "zip5": 17775}" "http://localhost:8087/admin/samples/labs" 

Back to the top

PUT - /admin/samples/labs/{id}

This route handles a PUT request and returns the SampleLabs record that was updated in the database by the call to the route.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8",
        "required": true
    }
    

Path Parameters

  • id of the SampleLab to update, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": "",
        "required": true
    }
    

Body Parameters

  • body, that should contain a JSON object with the data to update the SampleLab, that should respect the following schema:
    #!json
    {
        "name": "[.]{1, 64}",
        "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
        "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}",
        "line1": "[.]{1, 64}",
        "city": "[.]{1, 64}",
        "state": "[A-Z]{2}",
        "zip5": "\d{5, 11}",
        "active": "[0-1]{1}"
    }
    
    where name, email, line1, city, state, zip5, and active are all required.

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the SampleLab that was updated, that should respect the following schema:
    #!json
    {
        "lab": {
            "id": "[\d]{1, 11}",
            "name": "[.]{1, 64}",
            "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
            "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}",
            "idLocation": "[\d]{1, 11}",
            "active": "[0-1]{1}"
        }
    }
    

cURL

#!bash
curl -X PUT -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "Content-Type: application/json" -d '{"name": "Poovey Labs", "email": "pammykins@poovey.com", "line1": "123 Fifth Avenue", "city": "New York", "state": "NY", "zip5": 17775, "active": 1}' "http://localhost:8087/admin/samples/labs/15"

Back to the top

GET - /admin/samples/list

This route handles a GET request and returns an empty object for the user.

Request

Header Parameters

  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8"
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object that is empty, that should respect the following schema:
    #!json
    {}
    

cURL

#!bash
curl -X GET -H "Content-Type: application/json" "http://localhost:8087/admin/samples/list"

Back to the top

GET - /admin/samples/list.json

This route handles a GET request and returns the list of SampleLabs for the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8"
    }
    

Querystring Parameters

  • companyIds, a comma-delimited list of the Companies that the user may access without spaces, that should respect the following schema:
    #!json
    {
        "type": "string",
        "format": "[[\d]{1, 11}[,]?]+",
        "default": "",
        "required": true
    }
    
  • draw, a count of the number of "draws" that the datatable calling the route has had, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": -1,
        "required": false
    }
    
  • start, the starting record to return with, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": 0,
        "required": false
    }
    
  • length, the number of records to return with, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": 10,
        "required": false
    }
    
  • columns, the extra filters that may be placed on the SQL query, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "columns[n][data|name|searchable|orderable|search[value|regex]]",
        "default": "",
        "required": false
    }
    
  • order, the sort order the columns should return with, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "order[n][column|dir]",
        "default": "",
        "required": false
    }
    
  • search, the general search to be performed on the SQL query, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "search[value|regex]",
        "default": "",
        "required": false
    }
    

Response

Header Response

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the list of SampleLabs, that should respect the following schema:
    #!json
    {
        "data": [
            {
                "DT_RowId": "[\d]{1, 11}",
                "retailer": "[.]{1, 64}",
                "labName": "[.]{1, 64}",
                "daysInQueue": "[\d]+\.\d"
             }
             ...
        ],
        "draw": "\d+",
        "recordsTotal": "\d+",
        "recordsFiltered": "\d+"
    }
    

cURL

#!bash
curl -X GET -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" "http://localhost:8087/admin/samples/list.json?companyIds=1%2C11%2C21&draw=1&start=0&length=25&columns%5B0%5D%5Bdata%5D=c.name&columns%5B0%5D%5Bname%5D=retailer&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bdata%5D=sl.name&columns%5B0%5D%5Bname%5D=labName&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&search%5Bvalue%5D=&search%5Bregex%5D=false"

Back to the top

GET - /admin/samples/review

This route handles a GET request and returns an empty object for the user.

Request

Header Parameters

  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8"
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object that is empty, that should respect the following schema:
    #!json
    {}
    

cURL

#!bash
curl -X GET -H "Content-Type: application/json" "http://localhost:8087/admin/samples/review"

Back to the top

GET - /admin/samples/review.json

This route handles a GET request and returns the list of Sample Fields ready for review for the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8"
    }
    

Querystring Parameters

  • companyIds, a comma-delimited list of the Companies that the user may access without spaces, that should respect the following schema:
    #!json
    {
        "type": "string",
        "format": "[[\d]{1, 11}[,]?]+",
        "default": "",
        "required": true
    }
    
  • draw, a count of the number of "draws" that the datatable calling the route has had, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": -1,
        "required": false
    }
    
  • start, the starting record to return with, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": 0,
        "required": false
    }
    
  • length, the number of records to return with, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": 10,
        "required": false
    }
    
  • columns, the extra filters that may be placed on the SQL query, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "columns[n][data|name|searchable|orderable|search[value|regex]]",
        "default": "",
        "required": false
    }
    
  • order, the sort order the columns should return with, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "order[n][column|dir]",
        "default": "",
        "required": false
    }
    
  • search, the general search to be performed on the SQL query, that should respect the following schema:
    #!json
    {
        "type": "array",
        "format": "search[value|regex]",
        "default": "",
        "required": false
    }
    

Response

Header Response

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the list of Sample Fields ready for review, that should respect the following schema:
    #!json
    {
        "data": [
            {
                "DT_RowId": "[\d]{1, 11}",
                "retailer": "[.]{1, 64}",
                "fieldName": {
                    "name": "[.]{1, 64}",
                    "id": "[\d]{1, 11}"
                },
                "siteId": "[\d]{1, 11}",
                "mapId": "[\d]{1, 11}",
                "daysInQueue": "[\d]+\.\d",
                "commentCount": "[\d]{1, 11}",
             }
             ...
        ],
        "draw": "\d+",
        "recordsTotal": "\d+",
        "recordsFiltered": "\d+"
    }
    

cURL

#!bash
curl -X GET -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" "http://localhost:8087/admin/samples/review.json?companyIds=1%2C11%2C21&draw=1&start=0&length=25&columns%5B0%5D%5Bdata%5D=c.name&columns%5B0%5D%5Bname%5D=retailer&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bdata%5D=sl.name&columns%5B0%5D%5Bname%5D=labName&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&search%5Bvalue%5D=&search%5Bregex%5D=false"

Back to the top

GET - /admin/samples/takers

This route handles a GET request and returns a list of SampleTakers records to the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the list of SampleLabs, that should respect the following schema:
    #!json
    {
        "sampleTakers": [
            {
                "id": "[\d]{1, 11}",
                "name": "[.]{1, 64}",
                "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
                "idLocation": "[\d]{1, 11}",
                "idUser": "[\d]{1, 11}",
                "active": "[0-1]{1}",
                "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}"
            },
            ....
        ]
    }
    

cURL

#!bash
curl -X GET -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" "http://192.168.99.100:8087/admin/samples/takers" 

Back to the top

POST - /admin/samples/takers

This route handles a POST request and returns the newly created SamplesTakers record to the user.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8",
        "required": true
    }
    

Body Parameters

  • body is dependent on the Content-Type of the Request Header. When the Content-Type is set to application/json the JSON equivalent of a SampleTakers record should be sent that should respect the following schema:
    #!json
    {
        "name" : "[.]{1, 64}", 
        "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}", 
        "line1": "[.]{1, 64}", 
        "city": "[.]{1, 64}", 
        "state": "[A-Z]{2}", 
        "zip5": "\d{5, 11}",
        "userId": "\d{0, 11}",
        "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}"
    }
    
    When the Content-Type is set to application/x-www-form-urlencoded a Parameter Key/Value pair string of parameters should be sent that should respect the following schema:
    name=[.]{1, 64}&email=[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}&line1=[.]{1, 64}&city=[.]{1, 64}&state=[A-Z]{2}&zip5=\d{5, 11}&userId=\d{0,11}&phoneNumber=[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the SampleTaker that was created, that should respect the following schema:
    #!json
    {
        "sampleTaker": {
            "id": "[\d]{1, 11}",
            "name": "[.]{1, 64}",
            "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
            "idLocation": "[\d]{1, 11}",
            "idUser": "[\d]{0, 11}",
            "active": "[0-1]{1}",
            "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}"
        }
    }
    

cURL

#!bash
curl -X "POST" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "Content-Type: application/json" -d '{"name": "Poovey Labs", "email": "pammykins@poovey.com", "line1": "123 Fifth Avenue", "city": "New York", "state": "NY", "zip5": 17775}" "http://localhost:8087/admin/samples/takers" 

Back to the top

PUT - /admin/samples/takers/{id}

This route handles a PUT request and returns the SampleTakers record that was updated in the database by the call to the route.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8",
        "required": true
    }
    

Path Parameters

  • id of the SampleTaker to update, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "\d+",
        "default": "",
        "required": true
    }
    

Body Parameters

  • body, that should contain a JSON object with the data to update the SampleTaker, that should respect the following schema:
    #!json
    {
        "name": "[.]{1, 64}",
        "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
        "line1": "[.]{1, 64}",
        "city": "[.]{1, 64}",
        "state": "[A-Z]{2}",
        "zip5": "\d{5, 11}",
        "active": "[0-1]{1}",
        "userId": "\d{0, 11}",
        "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}"
    }
    
    where name, email, line1, city, state, zip5, and active are all required.

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the SampleTaker that was updated, that should respect the following schema:
    #!json
    {
        "sampleTaker": {
            "id": "[\d]{1, 11}",
            "name": "[.]{1, 64}",
            "email": "[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9\.-]+{4, 128}",
            "idLocation": "[\d]{1, 11}",
            "idUser": "[\d]{0, 11}",
            "active": "[0-1]{1}",
            "phoneNumber": "[[^0-9]?([0-9]{3})[^0-9]?[^0-9]?([0-9]{3})[^0-9]?([0-9]{4})]{0, 15}"
        }
    }
    

cURL

#!bash
curl -X PUT -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "Content-Type: application/json" -d '{"name": "Poovey Labs", "email": "pammykins@poovey.com", "line1": "123 Fifth Avenue", "city": "New York", "state": "NY", "zip5": 17775, "active": 1}' "http://localhost:8087/admin/samples/takers/15"

Back to the top

GET - /admin/samples/update.json

This route handles a GET request and returns the Sample to the user that was updated as a result of the call.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    

Querystring Parameters

  • id , the ID of the Sample to update, that should respect the following schema:
    #!json
    {
        "type": "integer",
        "format": "[\d]{1, 11}",
        "default": "",
        "required": true
    }
    
  • taken , the DateTime the sample was taken, that should respect the following schema:
    #!json
    {
        "type": "string",
        "format": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])",
        "default": "",
        "required": true
    }
    
  • results , the results of the Sample which must be URL-encoded, that should respect the following schema:
    #!json
    {
        "type": "string",
        "format": "%7B%22no3foot1%22%3A [0-9]*\.?[0-9]+ %2C%22no3foot2%22%3A [0-9]*\.?[0-9]+ %2C%22nh4foot1%22%3A [0-9]*\.?[0-9]+ %2C%22nh4foot2%22%3A [0-9]*\.?[0-9]+ %7D",
        "default": "",
        "required": true
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the Sample that was updated, that should respect the following schema:
    #!json
    {
        "sample": {
            "id": "[\d]{1, 11}",
            "taken": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])", 
            "results": {
                "no3foot1": "[0-9]*\.?[0-9]+", 
                "no3foot2": "[0-9]*\.?[0-9]+", 
                "nh4foot1": "[0-9]*\.?[0-9]+", 
                "nh4foot2": "[0-9]*\.?[0-9]+"
            },
            "token": "[A-Za-z0-9]+",
            "created": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])",
            "modified": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])",
            "idFile": "[\d]{1, 11}"
        }
    }
    

cURL

#!bash
curl -X GET -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" "http://localhost:8087/admin/samples/update.json?id=8&taken=2017-03-28%2000:00:00&results=%7B%22no3foot1%22%3A1.1%2C%22no3foot2%22%3A2.2%2C%22nh4foot1%22%3A3.3%2C%22nh4foot2%22%3A4.4%7D" 

Back to the top

POST - /admin/samples/update.json

This route handles a POST request and returns the Sample to the user that was updated as a result of the call.

Request

Header Parameters

  • X-Connect-DB, the database the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "Connect_Revdemo_Dev",
        "required": false
    }
    
  • X-Connect-DB-User, the database user the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "dtn_revdemo",
        "required": false
    }
    
  • X-Connect-DB-Password, the database password the microservice should authenticate with, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "3b22df72ed77ae02be3fb9ecf59d69475141bd8f",
        "required": false
    }
    
  • X-Connect-Host, the database server the microservice should connect to, should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "127.0.0.1",
        "required": false
    }
    
  • Content-Type should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json; charset=utf-8",
        "required": true
    }
    

Body Parameters

  • body is dependent on the Content-Type of the Request Header. When the Content-Type is set to application/json the JSON equivalent of a SampleLabs record should be sent that should respect the following schema:
    #!json
    {
        "id": "[\d]{1, 11}", 
        "taken": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])", 
        "results": "{\"no3foot1\": [0-9]*\.?[0-9]+, \"no3foot2\": [0-9]*\.?[0-9]+, \"nh4foot1\": [0-9]*\.?[0-9]+, \"nh4foot2\": [0-9]*\.?[0-9]+}"
    }
    

Response

Header Parameters

  • connection that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "keep-alive"
    }
    
  • content-type that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "application/json"
    }
    
  • keep-alive that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "timeout=60"
    }
    
  • server that should respect the following schema:
    #!json
    {
        "type": "string",
        "default": "kore (x.y.z)"
    }
    

Response Body

  • body, that should contain a JSON object with the Sample that was updated, that should respect the following schema:
    #!json
    {
        "sample": {
            "id": "[\d]{1, 11}",
            "taken": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])", 
            "results": {
                "no3foot1": "[0-9]*\.?[0-9]+", 
                "no3foot2": "[0-9]*\.?[0-9]+", 
                "nh4foot1": "[0-9]*\.?[0-9]+", 
                "nh4foot2": "[0-9]*\.?[0-9]+"
            },
            "token": "[A-Za-z0-9]+",
            "created": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])",
            "modified": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])",
            "idFile": "[\d]{1, 11}"
        }
    }
    

cURL

#!bash
curl -X "POST" -H "X-Connect-DB: Connect_Growmark_Test" -H "X-Connect-DB-User: dtn_growmark" -H "X-Connect-DB-Password: d49ab8732cd2859a48378d8cd7b5e3bd13eee978" -H "X-Connect-Host: appsql-av-t01-cluster.cluster-ctaywbg8mtxw.us-east-1.rds.amazonaws.com" -H "Content-Type: application/json" -d '{"id":8,"taken":"2017-03-28 00:00:00","results":"{\"no3foot1\":1.1,\"no3foot2\":2.2,\"nh4foot1\":3.3,\"nh4foot2\":4.4}"}" "http://localhost:8087/admin/samples/update.json" 

Back to the top

Updated