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

update URLs and use of HTTP methods for better consistency in API #1

Open
mblackstock opened this issue Jan 30, 2013 · 0 comments
Open

Comments

@mblackstock
Copy link
Member

Things

A single top level ‘/things’ resource should be used to create (POST), read and search (GET), update (PUT) and delete things (DELETE).

for consistency, the following URLs should be merged into one - /things
POST /thing -> POST /things
PUT /thing -> PUT /things
GET /thing/search -> GET /things
Events

A single top level ‘/events’ resource or a sub-resource of /things should be used to create, read, update and delete events

this could be:
/things/{thing-id}/events

If events are sub-resources of things

or

/events/{thing-id}

or

/events?{query-params}
/events/{event-id}

If they can be addressed independently of things

You should use HTTP methods as follows

GET - gets events for the thing
POST - adds a new event
PUT - updates an event by id
DELETE - deletes an event by id
Event Sub-Resources

Info

Info should not be in a sub-field -- can’t we just add top level fields to an event? Currently there is a POST to update an event, and a PUT to update the ‘info’ field of an event. Shouldn’t PUT to the event resource update the info fields? If info is an event sub-resources, these should be appended to the event resource e.g.
PUT /things/{thing-id}/events/{event-id}/info
or
PUT /events/{thing-id}/{event-id}/info
Content? or Data?

Related to above, /events/data, It looks like event ‘content’ is called ‘data’ in the representation. This is an event sub-resource, like info it looks like. A better URL would be:

/events/thing-id/event-id/data
or
/data

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

1 participant