Search code examples
web-servicesuristandardsconventions

Can someone point me to a webservice URI naming convention?


For example, create an object, updating an object, retrieving an object by ID, retrieving an object by name.

POST to: /object/create
POST to: /object/update
GET to: /object/getById?id={0}
GET to: /object/getByName?name={0}

Or is there a convention of maybe /object/create/create or similar?

I'm trying to create a uniform style of webservice.


Solution

  • There are many ways to model URIs, You will get a lot of confusing references on web, not that they are wrong but most of them are correct in their own context.

    http://soaprobe.blogspot.co.uk/2012/10/soa-rest-service-naming-guideline.html

    http://architects.dzone.com/news/common-rest-design-pattern

    In your example may be you can model it this way.

    POST to: /object - this will create the object

    PUT to: /object -- this will update the object

    GET to: /object?id={0} -- this will GET the object by id

    GET to: /object?name={0} -- this will update the object by name