4

I knew that we can get record by passing id of a record in workbench and we can get a record by passing name of a record(using where condition) by using rest class. But i want to know that,

(I might thinking, this is not possible, but to get confirmation i am posting this query)

can we get a record using get method in workbench with out using rest class by passing a name?

I tried with many ways by passing many urls in workbench. But, i am getting path error always. Example urls which i have tried

/services/data/v37.0/sobjects/account?name='Mine'
/services/data/v37.0/sobjects/account?name:Mine

if there is any solutions, please suggest me.

4

Unfortunately thats not possible. You can fetch the records using the Id or the externalId field using this format.

curl https://yourInstance.salesforce.com/services/data/v20.0/sobjects/Merchandise__c/MerchandiseExtID__c/123 -H "Authorization: Bearer token"

Response

{ 
    "attributes" : {
        "type" : "Merchandise__c",
        "url" : "/services/data/v20.0/sobjects/Merchandise__c/a00D0000008oWP8IAM"
     },
    "Id" : "a00D0000008oWP8IAM",
    "OwnerId" : "005D0000001KyEIIA0",
    "IsDeleted" : false,
    "Name" : "Example Merchandise",
    "CreatedDate" : "2012-07-12T17:49:01.000+0000",
    "CreatedById" : "005D0000001KyEIIA0",
    "LastModifiedDate" : "2012-07-12T17:49:01.000+0000",
    "LastModifiedById" : "005D0000001KyEIIA0",
    "SystemModstamp" : "2012-07-12T17:49:01.000+0000",
    "Description__c" : "Merch with external ID",
    "Price__c" : 10.0,
    "Total_Inventory__c" : 100.0,
    "Distributor__c" : null,
    "MerchandiseExtID__c" : 123.0
}

Reference

Or as you mention in your question You need to use SOQL for other fields.

curl https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token"

Reference

  • 1
    Your answer starts with "Unfortunately thats now possible" . Did you mean to say? "Unfortunately thats not possible" – javanoob Dec 26 '16 at 13:41
1

I don't think so this is possible but you can always query record through REST API using Q parameter.

URI /vXX.X/query/?q=SOQL query

You can get more info here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy