EnviroCar Service

Developer Guide

API Reference

Linked Open Data

Additional encodings for tracks

/tracks

GET

Get a list of all tracks.

Response Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/tracks.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "tracks"
    ],
    "properties": {
        "tracks": {
            "type": "array",
            "minItems": 0,
            "items": {
                "$ref": "http://schema.envirocar.org/definitions.json#/track-ref"
            }
        }
    }
}

Response Example

{
    "tracks": [
        {
            "id": "51dff239e4b0feb05dbee0d7",
            "modified": "2013-07-12T12:10:33Z",
            "name": "Track 2013-7-12"
        },
        {
            "id": "51dff0a1e4b0feb05dbee00e",
            "modified": "2013-07-12T12:03:45Z",
            "name": "Track 2013-7-12"
        },
        {
            "id": "51dfefa1e4b0feb05dbedfbf",
            "modified": "2013-07-12T11:59:29Z",
            "name": "Track 2013-7-12"
        },
        {
            "id": "51dfeed9e4b0feb05dbedf68",
            "modified": "2013-07-12T11:56:09Z",
            "name": "Track 2013-7-12"
        },
        {
            "id": "51dfee07e4b0feb05dbedf0b",
            "modified": "2013-07-12T11:52:39Z",
            "name": "Track 2013-7-12"
        }
    ]
}

In addition to the standard query parameters, tracks can be queried by a given boundingbox. Therefore you have to add the following get parameter: bbox=minx,miny,maxx,maxy. (example: /tracks?bbox=7.0,51.1,7.3,52.0)

POST

Creates a new tracks and adds current user as the owner.

Request Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/track.create.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "properties"
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "FeatureCollection"
            ]
        },
        "properties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "sensor"
            ],
            "properties": {
                "sensor": {
                    "type": "string",
                    "description": "the name of an existing sensor resource"
                },
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "appVersion": {
                    "type": "string"
                },
                "obdDevice": {
                    "type": "string"
                },
                "touVersion": {
                    "type": "string"
                },
                "length": {
                    "type": "number"
                }
            }
        },
        "features": {
            "type": "array",
            "minItems": 0,
            "items": {
                "$ref": "http://schema.envirocar.org/measurement.create.json#"
            }
        }
    }
}

Request Example

{
    "properties": {
        "sensor": "51bc53ab5064ba7f336ef920",
        "name": "test track",
        "description": "description of track"
    },
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    12.365,
                    24.068
                ]
            },
            "properties": {
                "time": "2013-05-16T02:13:27Z",
                "sensor": "51bc53ab5064ba7f336ef920",
                "phenomenons": {
                    "testphenomenon3": {
                        "value": 3.457
                    }
                }
            }
        }
    ]
}

/tracks/:trackid

GET

Get a track.

Response Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/track.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "properties",
        "features",
        "type"
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "FeatureCollection"
            ]
        },
        "features": {
            "type": "array",
            "minItems": 0,
            "items": {
                "$ref": "http://schema.envirocar.org/measurement.json#"
            }
        },
        "properties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "id",
                "sensor"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "created": {
                    "type": "string",
                    "format": "date-time"

                },
                "modified": {
                    "type": "string",
                    "format": "date-time"
                },
                "sensor": {
                    "$ref": "http://schema.envirocar.org/sensor.json#"
                },
                "user": {
                    "$ref": "http://schema.envirocar.org/user.json#"
                },
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "appVersion": {
                    "type": "string"
                },
                "obdDevice": {
                    "type": "string"
                },
                "touVersion": {
                    "type": "string"
                },
                "length": {
                    "type": "number"
                },
                "begin": {
                    "type": "string",
                    "format": "date-time"
                },
                "end": {
                    "type": "string",
                    "format": "date-time"
                }
            }

        }
    }
}

Response Example

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    7.61083,
                    51.9414
                ],
                "type": "Point"
            },
            "properties": {
                "id": "51c980c8e4b05956bbffceff",
                "phenomenons": {
                    "CO2": {
                        "unit": "g/s",
                        "value": 0.0
                    },
                    "Consumption": {
                        "unit": "l/s",
                        "value": 0.0
                    },
                    "MAF": {
                        "unit": "l/s",
                        "value": 0.0
                    },
                    "Speed": {
                        "unit": "km/h",
                        "value": 0.0
                    }
                },
                "time": "2013-06-08T11:28:20Z"
            },
            "type": "Feature"
        },
        {
            "geometry": {
                "coordinates": [
                    7.59575,
                    51.973
                ],
                "type": "Point"
            },
            "properties": {
                "id": "51c980c9e4b05956bbffd1fd",
                "phenomenons": {
                    "CO2": {
                        "unit": "g/s",
                        "value": 2.91
                    },
                    "Consumption": {
                        "unit": "l/s",
                        "value": 0.0006227631614894954
                    },
                    "MAF": {
                        "unit": "l/s",
                        "value": 0.00026500560063382785
                    },
                    "Speed": {
                        "unit": "km/h",
                        "value": 34.0
                    }
                },
                "time": "2013-06-08T12:07:06Z"
            },
            "type": "Feature"
        }
    ],
    "properties": {
        "created": "2013-06-25T11:36:41Z",
        "description": "From home to IfGI",
        "id": "51c980c8e4b05956bbffcefd",
        "modified": "2013-06-25T11:36:43Z",
        "name": "Way to work",
        "sensor": {
            "properties": {
                "constructionYear": 2001,
                "fuelType": "gasoline",
                "id": "51c97f0ee4b05956bbffcef8",
                "manufacturer": "BMW",
                "model": "Z4"
            },
            "type": "car"
        },
        "user": {
            "country": "Germany",
            "created": "2013-06-25T09:56:13Z",
            "dayOfBirth": "1989-01-01",
            "firstName": "Jakob",
            "gender": "m",
            "language": "de-DE",
            "lastName": "M",
            "mail": "jakob@jakob.de",
            "modified": "2013-07-10T08:30:04Z",
            "name": "jakob1"
        }
    },
    "type": "FeatureCollection"
}

PUT

Modify a track.

Request Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/track.create.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "properties"
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "FeatureCollection"
            ]
        },
        "properties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "sensor"
            ],
            "properties": {
                "sensor": {
                    "type": "string",
                    "description": "the name of an existing sensor resource"
                },
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "appVersion": {
                    "type": "string"
                },
                "obdDevice": {
                    "type": "string"
                },
                "touVersion": {
                    "type": "string"
                },
                "length": {
                    "type": "number"
                }
            }
        },
        "features": {
            "type": "array",
            "minItems": 0,
            "items": {
                "$ref": "http://schema.envirocar.org/measurement.create.json#"
            }
        }
    }
}

Request Example

{
    "properties": {
        "sensor": "51bc53ab5064ba7f336ef920",
        "name": "test track",
        "description": "description of track"
    },
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    12.365,
                    24.068
                ]
            },
            "properties": {
                "time": "2013-05-16T02:13:27Z",
                "sensor": "51bc53ab5064ba7f336ef920",
                "phenomenons": {
                    "testphenomenon3": {
                        "value": 3.457
                    }
                }
            }
        }
    ]
}