URL Structure
table.url-info {margin-top:1em;margin-left:1em;width:90%}
table.url-info th {text-align:left;background-color:whitesmoke;;padding:0.25em;}
table.url-info td {padding:0.25em;}
.longurl {font-size:0.8em;font-family:Courier New,Courier,Monospace;}
.footnotes {font-size:0.8em;}
.sidebar {float:right;margin-left:1em;font-size:0.9em;width:25%;border:thin solid red;padding:1em;background-color:whitesmoke;}
img.browserurl {border:thin solid; margin-left:1em;margin-bottom:1em;}
li {font-size:1.1em;}
Recently I decided I wanted to create soom "quick launch" bookmarklets for Salesforce.com. I wanted buttons on my browser toolbar that would take me to specific Mods in Saleforce.com and execute the exact action I wanted without having to first visit a page with such a link, or worse having to use that infernal little drop down for creating new records/objects. For example, I really wanted a button for creating a new Account that was always available.
Of course creating a quick launch button requires understanding Salesforce.com’s URL structure because Salesforce.com in their infinte wisdom has decided that Professional and Team customers are second class and don’t need access to the API because we are just not sophisticated enough to need it. (Sorry there if my sarcasm there is just a bit too obvious.)
Anyway, though I didn’t do an exhaustive search, I googled and couldn’t find anything that explained it so I attempted to grok it on my own. Based on my research which I was obviously only able to do with my own account and thus might not fully apply to others, It appears their URLs work something like this assuming you are logged into Saleforce.com:
Code Module URL to Module Home Page 001 Accounts https://<s>.salesforce.com/001/o 003 Contacts https://<s>.salesforce.com/003/o 006 Opportunities https://<s>.salesforce.com/006/o 015 Documents https://<s>.salesforce.com/015/o 500 Cases https://<s>.salesforce.com/500/o 501 Solutions https://<s>.salesforce.com/501/o 800 Contracts https://<s>.salesforce.com/800/o 00O Reports https://<s>.salesforce.com/00O/o 00Q Leads https://<s>.salesforce.com/00Q/o 01Z Dashboards https://<s>.salesforce.com/01Z/o a00 Custom Tabs1 https://<s>.salesforce.com/a00/o a01 Products https://<s>.salesforce.com/a01/o 1 Of course this is just for the first custom tab. Not sure about what happens we you create more.
For <s> I have always found it to be "na1" for (I assume) "North American server #1" (although I tried "sa1" and "eu1" and they both gave me a "Could not find domain" result in my browser so maybe that theory isn’t so good.) I even tried to set up a secondary DNS server to pull down the subdomains for Salesforce.com, but they evidently have them configured to block Zone transfers (go figure!). Here’s my CMD window/NSLookup transcript:
C:Program FilesSupport Tools>nslookupDefault Server: xxxxAddress: 192.168.0.1 > salesforce.comServer: xxxxAddress: 192.168.0.1 Non-authoritative answer:Name: salesforce.comAddress: 204.14.234.33 > set type=ns> salesforce.comServer: xxxxAddress: 192.168.0.1 Non-authoritative answer:salesforce.com nameserver = pdns6.ultradns.co.uksalesforce.com nameserver = pdns5.ultradns.infosalesforce.com nameserver = pdns4.ultradns.orgsalesforce.com nameserver = pdns3.ultradns.orgsalesforce.com nameserver = pdns2.ultradns.netsalesforce.com nameserver = pdns1.ultradns.net pdns6.ultradns.co.uk internet address = 204.74.115.1pdns3.ultradns.org internet address = 199.7.68.1
Moving on, I researched URLs for the following actions:
Action
URL to Excute AcctionView All Objects https://<s>.salesforce.com/<m>
View Object’s Home https://<s>.salesforce.com/<m>/o
View Object https://<s>.salesforce.com/<m><o>
Add Object https://<s>.salesforce.com/<m>/e?retURL=<r>
Edit Object https://<s>.salesforce.com/<m><o>/e?retURL=<r>
Clone Object https://<s>.salesforce.com/<m><o>/e?retURL=<r>&clone=1
Add Related Task https://<s>.salesforce.com/<m>/e?retURL=<r>&who_id=<m><o>
In the above table:
- The term "Object" refers to a instance/record in a Module, i.e. an Account, a Lead, a Contact, etc.
- retURL will often start with "%2F" when viewed in your browser. %2F is just the hex-encoded equivalent of "/" that the browser performs automatically on such characters when found in URL parameters.
- <s> always seemed to be "na4" for these URLs, but your mileage may vary.
- <m> refers to the three position alphanumeric from the first table (i.e. "003" for Contacts and "01Z" for Dashboards.)
- <o> refers to the internal ID that Saleforce.com maintains for every unique object in its system. If you ever use the Excel Connector for mass data updates you’ll get to directly play with them (Professional Editions and above only; Team Edition customers need not apply.).
- <r> refers to the previous domain-relative URL (i.e. starting with a "/" instead of "http://na4.salesforce.com/") to which Salesforce.com should return after the user completes the request action. If retURL is omitted, SaleForce.com returns to "/home/home.jsp".
- who_id refers to the Object to which the task should be associated, prefix with it’s Mod code.
If it’s more than a few days since Oct. 1, 2006 you might want to also check out this link for updated information:
There are a lot of other URLs in Salesforce.com, but they start breaking down in consistency and use different conventions for similar concepts as if different groups within Salesforce.com implemented them and they didn’t have the foresight to coordinate on conventions. However, I think I’ve documented the most important URLs and with the above information you can probably grok any others on your own. Besides. I wasn’t planning on writing a complete manual on Salesforce.com URLs when I sat down to write this post.
BTW, one of my ongoing campaigns has for a long time been to see more web developers and designed consider URL design to be an important component of web application design. As such, I recently launched a website called WellDesignedUrls.org with a mission to encourage more people to recognize the value of good URL design. On the aspect of URL design, I would give Saleforce.com a grade of B+ which is much better than I would give most websites.
At WellDesignedUrls.org among other things I plan to (get people to) document URL Structure for the various websites and installable web applications, especially if not documented by their respective vendor. That said, I’m going to copy this information about Saleforce.com’s URL Structure over to WellDesignedUrls.org wiki and potentially augment it over time.
If you do end up figuring out any of the other URLs, please just on over to the Saleforce.com’s URL Structure section on the wiki for WellDesignedUrls.org and document the layout for the benefit of future seekers of the same information. Also go ahead and post a comment here indicating which URL you documented and a another link to the wiki page where your updates can be found.





You’ve got it all figured out
. You might have also noticed that when you’re looking at a single record, the url is even simpler, with just the record id after the domain. The first three characters of the record id are the same as the prefix for that object, so you can often tell from a url what kind of object it links to.
About the subdomains - they are :AP, EMEA, NA1, NA2, NA3, NA4. You can find them all on trust.salesforce.com. They are region-wise splits (AP - Asia Pacific & EMEA - Europe, Middle East & Africa).
The reason we don’t have it cataloged is because we don’t want to encourage use of the url as API. We do try to make it possible, and if you use it that way, we’ll just wink at you, but we’re not putting a seal of approval on it.
Forgot to mention - your uri’s will work on any org as long as the region based subdomain is changed to the org’s native sub domain.
Admins Corner: Some thoughts on URL Structure from Thoughts on Salesforce.com
Great article over on Thoughts on Salesforce.com. This discussion revolves around understanding the structure of that confusing blog of text in the address bar, the Salesforce URL. So why is this important?
Well, when you get into the more advanced tip…
Salesforces URL Structure
Mike at Thoughts on Salesforce.com posted a nice overview of the Salesforce.com URL Structure.
He also references a site Id never heard of called welldesignedurls.org. Heres a link to the Salesforce page on that site.
…
Salesforce.com’s URL Structure
Quick mention of my documenting Saleforce.com’s URL structure…
Kingsley,
Mucho thanks for commenting. I *really* appreciate it.
But would you mind clarifing a few things, please?
1.) You mention the different subdomains, but you didn’t specify the difference between NA1, NA2, NA3, and NA4. Are the all equivalent, or as my inspection indicated, are they being used for different things?
2.) I notice http://trust.salesforce.com shows an SSL subdomain. What is it and how is it used?
3.) When you say “You might have also noticed that when you’re looking at a single record, the url is even simpler, with just the record id after the domain.” can you clarify with a specific example?
4.) When you say “your uri’s will work on any org as long as the region based subdomain is changed to the org’s native sub domain” how do I know? Do I just login and see? Is there any way to know in advance? If I wanted to write a bookmarklet that would work for any random salesforce user, how could I know without them having to (be technical enough to) tell me?
5.) I know you say that you don’t encourage the use of the URL as API, but would you help me maintain the following? http://wiki.welldesignedurls.org/Salesforce.com It’s not an official Saleforce.com site and only those who really wanted the information would find it. You wouldn’t even need to login under your own name, just a psuedonym!
6.) Has Saleforce.com considered using Microformats on your pages such as hCard (http://microformats.org/wiki/hcard), hCalendar (http://microformats.org/wiki/hcalendar), XOXO http://microformats.org/wiki/xoxo, and more
7.) Has Saleforce.com considered offering a REST/RSS/Atom based API and offering to everyone, even Team edition customers? If not, you might find this post of interest: http://www.mikeschinkel.com/blog/TheRoadkillOfTheWeb20Era.aspx
I’ll provide a more detailed response via email, but the answer to 6 is at http://microformats.org/wiki/implementations#Salesforce
just to put a finer point on Kingsley’s comment — just keep in mind that it’s not currently a supported API. We don’t change our URLs often, but they are subject to change without notice. So, coder beware.
Kingsley: Cool on the Microformats! I look forward to that email.
Pete: I appreciate what you are saying about the URL; programmers for years have programmed against “undocumented” APIs and have always been warned about the potential pitfalls.
That said, I would like to postulate that, with microformats I think we’ll start to see “Casual Web Services (CWS)” or maybe we’ll call them “Structured Screen Scraping (S3)” where HTML web pages become simple REST-based web services.
I for one plan to promote that concept in a far broader scope than just Salesforce on my main blog at http://www.mikeschinkel.com/blog/ as well as among the microformat lists that I have just joined. I would hope I could encourage Salesforce.com to consider being an early adopter of that initiative.