Wiki
Clone wikidtn-nwatch / Root Routes
Root Routes
PUT - /{token}
This route handles a PUT request and returns the Sample
record that was created or 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
- token of the
Sample
to create or update, that should respect the following schema:#!json { "type": "string", "format": "[A-Za-z0-9]+", "default": "", "required": true }
Body Parameters
- body, that should contain a
JSON
object with the data to create or update the nitrogen results, that should respect the following schema:{ "type": "string" "format": "{ \"taken\": \"(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\", \"no3foot1\": \"[0-9]*\.?[0-9]+\", \"no3foot2\": \"[0-9]*\.?[0-9]+\", \"nh4foot1\": \"[0-9]*\.?[0-9]+\", \"nh4foot2\": \"[0-9]*\.?[0-9]+\" }", "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 theSample
that should respect the following schema:#!json { "taken": "(19|20)\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])", "no3foot1": "[0-9]*\.?[0-9]+", "no3foot2": "[0-9]*\.?[0-9]+", "nh4foot1": "[0-9]*\.?[0-9]+", "nh4foot2": "[0-9]*\.?[0-9]+" }
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 '{\"taken\": \"2017-03-24\", \"no3foot1\": \"15.4\", \"no3foot2\": \"9.2\", \"nh4foot1\": \"12.9\", \"nh4foot2\": \"6.3\"}' "http://localhost:8087/25yqrdve00"
GET - /health
This route handles a GET request and returns the string "UP" to let the checking consul service know the microservice is alive.
Request
Header Parameters
- Content-Type should respect the following schema:
#!json { "type": "string", "default": "text/plain; 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 string, that should respect the following schema:
UP
cURL
#!bash curl -X GET -H "Content-Type: text/plain" "http://localhost:8087/health"
GET - /version
This route handles a GET request and returns a string with the current microservice version.
Request
Header Parameters
- Content-Type should respect the following schema:
#!json { "type": "string", "default": "text/plain; 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 string, that should respect the following schema:
nWatch Microservice vX.Y.Z
cURL
#!bash curl -X GET -H "Content-Type: text/plain" "http://localhost:8087/version"
Updated