Andy-H Posted July 9, 2012 Share Posted July 9, 2012 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 https://forums.phpfreaks.com/topic/265412-restful-api-design-help/ Share on other sites More sharing options...
Andy-H Posted July 9, 2012 Author Share Posted July 9, 2012 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 https://forums.phpfreaks.com/topic/265412-restful-api-design-help/#findComment-1360232 Share on other sites More sharing options...
ignace Posted July 9, 2012 Share Posted July 9, 2012 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 https://forums.phpfreaks.com/topic/265412-restful-api-design-help/#findComment-1360241 Share on other sites More sharing options...
Andy-H Posted July 9, 2012 Author Share Posted July 9, 2012 OK, cheers. So just use whichever looks 'prettier' lol Link to comment https://forums.phpfreaks.com/topic/265412-restful-api-design-help/#findComment-1360255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.