Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4235740
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:32:33+00:00 2026-05-21T02:32:33+00:00

Numerical IDs vs names As an example, which of these would you choose for

  • 0

Numerical IDs vs names

As an example, which of these would you choose for identifying a single transaction, from a single bank account, for a single company:

  1. /companies/freds-painting-ltd/accounts/savings/transactions/4831
  2. /companies/freds-painting-ltd/accounts/1/transactions/4831
  3. /companies/62362/accounts/1/transactions/4831
  4. You idiot, something totally different! Crikey, did you even READ Fielding’s dissertation?

Now, I think the 1st one is the most readable. If I have more than one company, or if I’m someone like an accountant managing multiple companies, it’s immediately clear which company, and which account, I’m looking at. It’s also more bookmarkable/emailable and would prevent ‘fishing’ for other companies by changing the company ID. I would want transaction IDs to be unique to an account (I.e. Both ‘savings’ and ‘current’ accounts could have transaction ‘1’

A ‘company’ will be my ‘top-level’, or ‘first class’ resource. Nothing at all would ever be shared between companies. As such, it would be the ideal candidate for a shard (or ‘ancestor’/’namespace’ in Google App Engine parlance). So I’d only have to worry about the account names being unique within one company. Every company could have an account called ‘savings’.

Not sure what the situation in the rest of the world is, though LTDs or PLCs in UK would have a unique name, there could be many ‘Dave’s Window Cleaning’ businesses (what’s know as a trading name).

The business owner(s) could potentially opt for the top level /company/company-name URI to be public, and contain some basic details like their website, contact details etc, but everything below that would NEVER be accessible by search engines.

So my thoughts/concerns are:

1) Is it reasonable, when someone signs in to add their business, to say “Sorry, ‘Dave’s Window Cleaning’ business is taken. How about ‘Dave’s Window Cleaning Portsmouth’ (Having taken their location in another field)? My worry with this is that, for a more well known company, you’re giving away the fact that they have an account with you. Or that someone could use that form to search for names. Perhaps not a biggie.

2) The size of the company name. Would it be reasonable for a name like ‘Dave’s Window cleaning, gardening, and loads of other stuff’? Thus creating a URL like ‘daves-window-cleaning-gardening-and-loads-of-other-stuff/’

3) How to deal with someone changing their business name – I would approach it by creating a new company with that string ID, copying over everything, then deleting the old resource. The original URI would return 404 rather than redirecting – as you can’t guarantee someone else won’t want to take the now unused name, or even if more than one person has used the same name in the past.

4) Should the ‘real’ unique ID be an number in the back end, and for every request to be handled by first doing a query for what company ID this name actually related to.

5) The impact of searching for a transaction in the persistence layer.

6) The possibility of URL rewriting, but then that wouldn’t work cleanly in GAE, nor would it solve the issue of ensuring company names are unique.

RESTful webservice vs RESTful website

So, we potentially have this lovely RESTful webservice that the latest snazzy iphone/android app can use (delusions of grandeur). But what about the main website itself? I note, right now, that the URL I see at the top of my page is not ‘RESTful’: /questions/ask is an action. There is no ‘ask’ resource on the server. It’s more the state of the page, the preparation for POSTing to /questions/ – or if I’m editing, PUTing to /questions/{id}

I also note that Stackoverflow has URIs like /questions/362352/name-of-the-question, and that the latter part can be omitted, and one will be redirected to it.

Should I host a completely separate webapp that consumes my lovely webservice (from the same domain)? Do I even need a separate REST server, or can I rely on content negotiation (JSON/XML) and HTTP verb to select the right method (I’m using Jersey), and return the right representation?

So I could have /companies/aboxo/ return the whole HTML page (using stringtemplate.org) if it’s a GET /,text/plain or test/html, and JSON/XML for others?

But what happens for ‘add/edit/delete’ transaction? Would GET / /companies/freds-painting-ltd/savings/transactions/?template=add be ok (or GET ../transactions/352?template=edit), and that would return the right HTML?

Thinking about this last detail is driving me mad for some reason.

Comments, suggestions, outright ridicule – all welcome!

Marcos

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:32:34+00:00Added an answer on May 21, 2026 at 2:32 am

    Rails solves the “id vs name” problem by displaying both in the URL but using only the id to actually identify eg:

    /companies/62362-freds-painting-ltd/accounts/1-savings/transactions/4831
    

    ie – for the ones that have a “pretty url” the function that generates your path write both the id and the name… but for your router, where relevant: you strip off everything thats not the id.

    incidentally, it means your customer could actually write whatever they like into the URL and it’d make no difference:

    /companies/62362-i_luv_blue_turtles/accounts/1-your_mum/transactions/4831
    

    and your router still just sees:

    /companies/62362/accounts/1/transactions/4831
    

    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of a numerical library test I need to choose base 10 decimal
I have 2 columns of data with numerical values as follows which is tab
Given I've got a site where most of the resources have numerical IDs (i.e.
i have a table called category in which i have main category ids and
I'm currently replacing numeric ids in a url with a slug created from a
My model is built on non-numerical ID's (36-char. GUID to be specific). The problem
I am pretty confused by the deprecation of the numeric table ids and the
In numerical oriented languages (Matlab, Fortran) range operator and semantics is very handy when
I have a numerical field called category_id in my table. I want to do
i am using numerical updown in my form, there if i change the value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.