pires / obd-server

Webapp responsible for storing OBD (Android OBD Reader) readings.
Apache License 2.0
69 stars 53 forks source link

Requesting all VINs, not only specific/known VINs #3

Closed volands closed 10 years ago

volands commented 10 years ago

JSON Request Call 'http://localhost/obd/?vin=testvin' requires to know the specific VIN. In some use cases the VINs are not known in advance. Is there a possibility to request/get records/content of all VINs from server - surely, this can produce a lot of data in a single response but in my case it would be great. Additionally, a more elegant way could be to provide a solution to request/get a list of all/unique VINs.

pires commented 10 years ago

I'm changing the API a little bit to become more RESTy.

To request all persisted VINs:

GET http://server_ip:server_port/obd/vin

This request shall return a list of VINs, such as:

[
  "testvin",
  "othervin"
]

To request readings for othervin:

GET http://server_ip:server_port/obd/vin/othervin

This request shall return a list of readings for othervin, such as:

[
  {
    "latitude":40.0,
    "longitude":-8.1,
    "timestamp":1234567890,
    "vin":"testvin",
    "readings":{
      "speed":"55",
      "rpm":"3000"
    }
  },
  {
    "latitude":40.1,
    "longitude":-8.2,
    "timestamp":1234568999,
    "vin":"testvin",
    "readings":{
      "speed":"65",
      "rpm":"3200"
    }
  },
  {
    "latitude":40.2,
    "longitude":-8.3,
    "timestamp":1234589999,
    "vin":"testvin",
    "readings":{
      "speed":"75",
      "rpm":"4000"
    }
  }
]