+ Start a Discussion
IanDoneganIanDonegan 

How do I access a custom object through the rest API?

I have an external app that I would like to use to create records of a custom object through the rest API. I can create Accounts just fine, but have not been able to replicate that functionality for any custom object.

I took a look at workbench.developerforce.com, and found that the rest explorer is not returning information about any custom objects.

I am logged in as a system administrator, so I should have access to everything. What am I doing wrong?
Best Answer chosen by IanDonegan
Khan AnasKhan Anas (Salesforce Developers) 
Hi Ian,

Greetings to you!

You should try to grab the URL by GET method first. Then apply post on that URL.

URL: /services/data/v45.0/sobjects/Test__c

Method: POST
Body: Here assign the field values for all the required fields on that object. 

{
"Name":"Test Record 1"
}


Also, please make sure you are logged into workbench using the correct instance. For example, my Trailhead instance has different data from my Dev instance.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

GauravendraGauravendra

Hey Ian,

Make sure you are appending __c while accessing custom object name (API Name).
I do not find any other things which could be missing, if its working for standard object with Sys admin.

The path should look something like this
/services/data/v45.0/sobjects/Ant__c/

Hope this helps!

Khan AnasKhan Anas (Salesforce Developers) 
Hi Ian,

Greetings to you!

You should try to grab the URL by GET method first. Then apply post on that URL.

URL: /services/data/v45.0/sobjects/Test__c

Method: POST
Body: Here assign the field values for all the required fields on that object. 

{
"Name":"Test Record 1"
}


Also, please make sure you are logged into workbench using the correct instance. For example, my Trailhead instance has different data from my Dev instance.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
IanDoneganIanDonegan
Thanks for the help with this. I am not sure what changed, but I was probably just logging into the wrong org through the workbench. I can see all the custom objects that were missing yesterday.