markthegrea
markthegrea

Reputation: 3851

REST duplicate URLs

I have two urls:

blah.com/workorder/{dealer_code} 
blah.com/workorder/{cust_id}

Both of these return a workorder based on the data sent in. Both dealer_code and cust_id are String data (you couldn't tell the difference in them).

Supposing that there is no time or way to figure out on the back end which is which, how would you design this. I have a few ideas but don't want to lead. Also, it could get longer. What about if you had this:

blah.com/workorder/{dealer_code}/{id_no}/{category}
blah.com/workorder/{cust_id}/{ref_no}/{name}

Thoughts?

Upvotes: 2

Views: 523

Answers (1)

theon
theon

Reputation: 14380

Go for query string parameters.

It looks like you are doing searches because you are not looking up work orders by their id (primary key), but instead searching by other fields in the work order entities.

If you are looking up a work order by it's id use:

 blah.com/workorder/{id}

Otherwise use something like:

 blah.com/workorder?dealer_code=1&cust_id=1

Similar question: RESTful URL design for search

Upvotes: 3

Related Questions