Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

I am new to the sales force and I have a problem. I would like to manipulate (created, update, delete and select) data from my custom objects using the REST API.

I have managed to get the sample working and it is sending me the data for accounts. Details

Now I would like to do the same for the Custom Object I have created.

I have tried this code but it is not working.

HttpClient httpclient = new HttpClient();

GetMethod get = new GetMethod(instanceUrl + "/services/data/v22.0/sobjects/Employee__c/EC-1000");

get.setRequestHeader("Authorization", "OAuth " + accessToken);


System.out.println("Status:" + get.getStatusCode());

System.out.println("Status Text:" + get.getStatusText());

Output is: Status:404 Status Text: Not Found

I created an object with name employee and ID EC-1000.

The above works for the default objects that is Account.

1 Answer

0 votes
by (32.1k points)
edited by

Well, this works in the exact same way, you just need to custom object's API name instead of the standard object name. For example, if you have a custom object abs, its API name will be abs_c, and you can POST this to /services/data/v22.0/sobjects/abs__c to create a new one.

Are you interested in learning Salesforce from the basics! Refer to this video on Salesforce provided by Intellipaat:

So, to access a particular record, you need the 18 character record ID just like for the account.

Related questions

0 votes
1 answer

Browse Categories