title: Build a website: should I use a number or random unique string as ID in URLs?
body: <p>Hi I am building an Internet website with Java and Spring framework. I believe my question is not technology or framework related.</p>
  
  <p>I need to have links in user interface so that visitors can click and to see records. These links have the format of</p>
  
  <pre><code>http://mysite.com?id=number-id-or-random-unique-string
  </code></pre>
  
  <p>Not all records are allowed to view. For the ID parameter in the URL, I could use the database-generated number as the ID value and so I do not need to have additional programming. Or I could use unique random string (for example: jcTDjhdDUls) as the ID value (I have to program this part). Numbers allow curious people (with good or bad intentions) to EASILY guess and try other IDs. Unique random strings seems better in this regard. </p>
  
  <p>However, no matter numbers or strings as the value for the ID, I have security check in the backend code to see whether a visitor is allowed to see a record. From this perspective, I am not sure what is the real benefit of having random string as the ID.</p>
  
  <p>I hope to have input from experienced people. What design decision do you choose? Or other better ideas?</p>
  
  <p>Thanks and regards.</p>