Skip to content
Luke Campbell edited this page May 18, 2015 · 4 revisions

#Annotations

###GET /annotations

  • returns a list of ALL annotations

Parameters:

  • stream_name: returns annotations with an exact match for stream_name
  • reference_designator: returns annotations with an exact match for reference_designator
  • start_time: returns annotations with at least one point after start_time
  • end_time: returns annotations with at least one point before end_time
  • stream_parameter_name: returns annotations with an exact match for stream_parameter_name

Examples

curl -i -XGET 'http://localhost:4000/annotation?stream_name=vel3d_k_wfp_instrument'

HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 516
Access-Control-Allow-Origin: *
Set-Cookie: session=eyJfaWQiOnsiIGIiOiJaakJtTlRsbE9HRTNObVpsWlRJd05qazBaakkwWXpnMFlqRTJOVGN3TTJZPSJ9fQ.CDu3JQ.k-HPoFGzS-vYcnK-2Y1J9uGcE7s; HttpOnly; Path=/
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Mon, 18 May 2015 17:47:17 GMT

{
  "annotations": [
    {
      "created_time": "2015-05-18T13:45:34.142359-04:00",
      "description": "\u50d5\u306b\u3068\u3063\u3066\u3001\u305d\u306e\u7403\u304c\u5b8c\u74a7\u3060\u3002",
      "end_time": "2014-04-12T20:00:00-04:00",
      "id": 1,
      "reference_designator": "CP02PMCO-WFP01-01-VEL3DK000",
      "retired": false,
      "start_time": "2014-04-12T14:26:00-04:00",
      "stream_name": "vel3d_k_wfp_instrument",
      "stream_parameter_name": "vel3d_k_temp_c",
      "user_id": 1
    }
  ]
}

###GET /annotations/<int:id>

  • returns a single annotaion from supplied id
{
"annotations": [
    	{
        "comment": "test", 
        "created_time": "Thu, 05 Feb 2015 11:44:14 GMT", 
        "field_x": null, 
        "field_y": null, 
        "id": 1, 
        "instrument_name": null, 
        "modified_time": "Thu, 05 Feb 2015 11:44:14 GMT", 
        "pos_x": null, 
        "pos_y": null, 
        "stream_name": null, 
        "title": "Test Annotation", 
        "user_name": 1
    	}
	]
}

###POST /annotations

  • login required
  • "annotation" scope required
  • returns 201: created annotation
cat << 'EOF' > data
{
    "reference_designator" : "CP02PMCO-WFP01-01-VEL3DK000",
    "start_time" : "2014-04-12T1826Z",
    "end_time" : "2014-04-13T00:00Z",
    "stream_parameter_name": "vel3d_k_temp_c",
    "stream_name":"vel3d_k_wfp_instrument",
    "description" : "僕にとって、その球が完璧だ。"
}
EOF

curl -H 'Content-Type: application/json;charset=UTF-8' -i --user admin:admin -d@data -XPOST http://localhost:4000/annotation
HTTP/1.0 201 CREATED
Content-Type: application/json
Content-Length: 441
Access-Control-Allow-Origin: *
Set-Cookie: session=eyJfaWQiOnsiIGIiOiJaakJtTlRsbE9HRTNObVpsWlRJd05qazBaakkwWXpnMFlqRTJOVGN3TTJZPSJ9fQ.CDu2vg.ThF68XRt6nZ4-dUAeFqEuf-S1pU; HttpOnly; Path=/
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Mon, 18 May 2015 17:45:34 GMT

{
  "created_time": "2015-05-18T13:45:34.142359-04:00",
  "description": "\u50d5\u306b\u3068\u3063\u3066\u3001\u305d\u306e\u7403\u304c\u5b8c\u74a7\u3060\u3002",
  "end_time": "2014-04-12T20:00:00-04:00",
  "id": 1,
  "reference_designator": "CP02PMCO-WFP01-01-VEL3DK000",
  "retired": false,
  "start_time": "2014-04-12T14:26:00-04:00",
  "stream_name": "vel3d_k_wfp_instrument",
  "stream_parameter_name": "vel3d_k_temp_c",
  "user_id": 1
}

PUT /annotations/<int:id>

  • edit an individual annotation
  • login required
  • "annotation" scope required or user who created original annotation
cat << 'EOF' > data
{
    "id": 1,
    "reference_designator" : "CP02PMCO-WFP01-01-VEL3DK000",
    "start_time" : "2014-04-12T1826Z",
    "end_time" : "2014-04-13T00:00Z",
    "stream_parameter_name": "vel3d_k_temp_c",
    "stream_name":"vel3d_k_wfp_instrument",
    "description" : "English this time"
}
EOF

curl -H 'Content-Type: application/json' -i --user admin:admin -d@data -XPUT http://localhost:4000/annotation/1
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 374
Access-Control-Allow-Origin: *
Set-Cookie: session=eyJfaWQiOnsiIGIiOiJaakJtTlRsbE9HRTNObVpsWlRJd05qazBaakkwWXpnMFlqRTJOVGN3TTJZPSJ9fQ.CDu4dA.f8gcNVX4xSvatPZ952LwUEnd_HM; HttpOnly; Path=/
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Mon, 18 May 2015 17:52:52 GMT

{
  "created_time": "2015-05-18T13:45:34.142359-04:00",
  "description": "English this time",
  "end_time": "2014-04-12T20:00:00-04:00",
  "id": 1,
  "reference_designator": "CP02PMCO-WFP01-01-VEL3DK000",
  "retired": false,
  "start_time": "2014-04-12T14:26:00-04:00",
  "stream_name": "vel3d_k_wfp_instrument",
  "stream_parameter_name": "vel3d_k_temp_c",
  "user_id": 1
}

DELETE /annotation/<int:id>

  • will delete an annotation by id
  • login required
  • "annotation" scope required
curl -i --user admin:admin -XDELETE http://localhost:4000/annotation/1
HTTP/1.0 204 NO CONTENT
Content-Type: application/json
Content-Length: 0
Access-Control-Allow-Origin: *
Set-Cookie: session=eyJfaWQiOnsiIGIiOiJaakJtTlRsbE9HRTNObVpsWlRJd05qazBaakkwWXpnMFlqRTJOVGN3TTJZPSJ9fQ.CDu4sw.yp93JhrMuqdmF9RZtZ4OM0yBrKI; HttpOnly; Path=/
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Mon, 18 May 2015 17:53:55 GMT