Jump to content

RESTful API design help


Andy-H

Recommended Posts

Hi, I want to write a RESTful API to interface with our tracking units database, I was just wondering, which of the following would be closest to RESTful design:

 

 

To request a journey:

/devices/identifier/journeys/start_date/end_date

/devices/identifier/journeys/journeyID

 

 

or

 

 

/journeys/device_identifier/start_date/end_date

/journeys/journeyID

 

Thanks for any help.

Link to comment
Share on other sites

Just as a little-more in-depth explanation:

 

 

I am unsure as to which way to go here as a journey is an entity in itself (a collection of latlng locations, grouped with speed, bearing etc.) but it belongs to a device, i.e. can not exist without being created by (and linking to) a device, I am only just learning about REST and don't know what to do in this situation to conform to it.

 

 

I'm not bothered about strictly conforming to REST, i.e. supplying cache information with date etc. but would like to follow the url structure, idea of GET/PUT/POST/DELETE and HTTP response code error reporting.

 

 

 

 

Link to comment
Share on other sites

RESTful means you use HTTP verbs GET/POST/DELETE.

 

So

 

To request a journey:

/devices/identifier/journeys/start_date/end_date

/devices/identifier/journeys/journeyID

 

or

 

/journeys/device_identifier/start_date/end_date

/journeys/journeyID

 

Is both restful. Even foo.php?bar=bat is restful.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.