Proper/Safe Way to Link to Salesforce Object

What is the proper/safe way to get/generate links for Salesforce objects retrieved through the REST API?

For instance, we have a tool living in another application that allows users to query for Salesforce content objects from the context of this other application and directly embed a link (just eases the process of linking to Salesforce content). At the moment, I am relying on the ID and the Salesforce URL (e.g.,|sobjectId|) as the URL that is embedded. Ideally, for content, we would link to the version page instead (e.g.,|sobjectID|). Is there a way to safely generate/retrieve this URL with the rest API? Or can I simply assume this URL will exist for all content objects?

I have seen in the past APIs that return a list of “resources” (e.g, URLs for all CRUD operations on the object) alongside an object, but I haven’t seen anything like this in the documentation.


I know your question is about the REST API, but with the SOAP Partner API you can use DescribeSObjectResult to get the urlDetail, urlEdit, and urlNew. With these you can build up the correct URL by substituting the {ID} value.

It looks like there are equivalent fields available via the REST API. I say “looks like” as there is something off about that documentation. It looks more like the SOAP API docs than the REST API.

If you do an SObject Describe via the REST API you can get the “urls” in the response. Like the SOAP API, you can substitute the {ID} with your value.

curl -H   
     "Authorization: Bearer access_token" -H "X-PrettyPrint:1"


    "name" : "Account",
    "fields" :
    "updateable" : true,
    "label" : "Account",
    "urls" :
        "uiEditTemplate" : "{ID}/e",
        "sobject" : "/services/data/v20.0/sobjects/Account",
        "uiDetailTemplate" : "{ID}",
        "describe" : "/services/data/v20.0/sobjects/Account/describe",
        "rowTemplate" : "/services/data/v20.0/sobjects/Account/{ID}",
        "uiNewRecord" : ""

Source : Link , Question Author : user7266 , Answer Author : Daniel Ballinger

Leave a Comment