Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Parameters should be communicated to clients via URL templates #23

Open
ssfrr opened this issue Sep 30, 2014 · 1 comment
Open

URL Parameters should be communicated to clients via URL templates #23

ssfrr opened this issue Sep 30, 2014 · 1 comment

Comments

@ssfrr
Copy link
Member

ssfrr commented Sep 30, 2014

for instance, when requesting sensor data the user can provide a start and end timestamp, but currently the server does not tell the client which parameters are available.

@kkleidal
Copy link
Contributor

kkleidal commented Oct 6, 2014

What do you think about this approach: including a list of possible parameters in the response alongside the href. I played around with the idea on this branch:

kkleidal@dbfae46

Example output (I didn't actually define any params for the resource types shown):

{
  "building": "",
  "room": "",
  "floor": "",
  "description": "",
  "_links": {
    "ch:site": {
      "href": "http://127.0.0.1:8080/sites/1",
      "params": [],
      "title": "MIT Media Lab"
    },
    "curies": [
      {
        "href": "http://chain-api.media.mit.edu/rels/{rel}",
        "name": "ch",
        "templated": true
      }
    ],
    "self": {
      "href": "http://127.0.0.1:8080/devices/1",
      "params": []
    },
    "ch:websocketStream": {
      "href": "ws://127.0.0.1:8080/ws/device-1",
      "title": "Websocket Stream"
    },
    "ch:sensors": {
      "href": "http://127.0.0.1:8080/sensors/?device_id=1",
      "params": [],
      "title": "Sensors"
    },
    "editForm": {
      "href": "http://127.0.0.1:8080/devices/1/edit",
      "title": "Edit Device"
    }
  },
  "name": "example"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants