EnviroCar Service

Developer Guide

API Reference

Linked Open Data

Additional encodings for tracks

/measurements

GET

Get a list of all measurements.

Response Schema

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

Response Example

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    7.61083,
                    51.9414
                ],
                "type": "Point"
            },
            "properties": {
                "created": "2013-06-25T11:36:41Z",
                "id": "51c980c8e4b05956bbffceff",
                "modified": "2013-06-25T11:36:41Z",
                "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
                    }
                },
                "sensor": {
                    "properties": {
                        "constructionYear": 2001,
                        "fuelType": "gasoline",
                        "id": "51c97f0ee4b05956bbffcef8",
                        "manufacturer": "BMW",
                        "model": "Z4"
                    },
                    "type": "car"
                },
                "time": "2013-06-08T11:28:20Z",
                "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": "Feature"
        },
        {
            "geometry": {
                "coordinates": [
                    7.61083,
                    51.9414
                ],
                "type": "Point"
            },
            "properties": {
                "created": "2013-06-25T11:36:41Z",
                "id": "51c980c8e4b05956bbffcf01",
                "modified": "2013-06-25T11:36:41Z",
                "phenomenons": {
                    "CO2": {
                        "unit": "g/s",
                        "value": 4.11
                    },
                    "Consumption": {
                        "unit": "l/s",
                        "value": 0.0008795727126191843
                    },
                    "MAF": {
                        "unit": "l/s",
                        "value": 0.0003742862606890146
                    },
                    "Speed": {
                        "unit": "km/h",
                        "value": 0.0
                    }
                },
                "sensor": {
                    "properties": {
                        "constructionYear": 2001,
                        "fuelType": "gasoline",
                        "id": "51c97f0ee4b05956bbffcef8",
                        "manufacturer": "BMW",
                        "model": "Z4"
                    },
                    "type": "car"
                },
                "time": "2013-06-08T11:28:26Z",
                "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": "Feature"
        }
    ],
    "type": "FeatureCollection"
}

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

POST

Creates new measurements.

Request Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/measurement.create.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "type",
        "geometry",
        "properties"
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "Feature"
            ]
        },
        "geometry": {
            "$ref": "http://schema.envirocar.org/geometry.json#"
        },
        "properties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "time"
            ],
            "properties": {
                "sensor": {
                    "type": "string",
                    "description": "the id of an existing sensor"
                },
                "time": {
                    "type": "string",
                    "format": "date-time"
                },
                "phenomenons": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "value"
                        ],
                        "properties": {
                            "value": {
                                "type": [
                                    "string",
                                    "number",
                                    "boolean"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}

Request Example

{
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            12.365,
            24.068
        ]
    },
    "properties": {
        "time": "2013-05-16T02:13:27Z",
        "sensor": "51b1c2cb31db8e4e51795ea6",
        "phenomenons": {
            "TestPhenomenon": {
                "value": 3.457
            }
        }
    }
}

/measurements/:measurement

GET

Get the measurement measurement.

Response Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://schema.envirocar.org/measurement.json#",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "type",
        "geometry",
        "properties"
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "Feature"
            ]
        },
        "geometry": {
            "$ref": "http://schema.envirocar.org/geometry.json#"
        },
        "properties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "id",
                "time",
                "phenomenons"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "created": {
                    "type": "string",
                    "format": "date-time"

                },
                "modified": {
                    "type": "string",
                    "format": "date-time"

                },
                "sensor": {
                    "$ref": "http://schema.envirocar.org/sensor.json#"
                },
                "time": {
                    "type": "string",
                    "format": "date-time"
                },
                "user": {
                    "$ref": "http://schema.envirocar.org/user.json#"
                },
                "track": {
                    "type": "string"
                },
                "phenomenons": {
                    "type": "object",
                    "additionalItems": {
                        "type": "object",
                        "additionalProperties": false,
                        "allOf": [
                            {
                                "$ref": "http://schema.envirocar.org/phenomenon.json"
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "value": {
                                        "type": [
                                            "string",
                                            "number",
                                            "boolean"
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                }
            }
        }
    }
}

Response Example

{
    "geometry": {
        "coordinates": [
            7.61083,
            51.9414
        ],
        "type": "Point"
    },
    "properties": {
        "created": "2013-06-25T11:36:41Z",
        "id": "51c980c8e4b05956bbffcf01",
        "modified": "2013-06-25T11:36:41Z",
        "phenomenons": {
            "CO2": {
                "unit": "g/s",
                "value": 4.11
            },
            "Consumption": {
                "unit": "l/s",
                "value": 0.0008795727126191843
            },
            "MAF": {
                "unit": "l/s",
                "value": 0.0003742862606890146
            },
            "Speed": {
                "unit": "km/h",
                "value": 0.0
            }
        },
        "sensor": {
            "properties": {
                "constructionYear": 2001,
                "fuelType": "gasoline",
                "id": "51c97f0ee4b05956bbffcef8",
                "manufacturer": "BMW",
                "model": "Z4"
            },
            "type": "car"
        },
        "time": "2013-06-08T11:28:26Z",
        "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": "Feature"
}

DELETE

Deletes the measurement measurement.