Java Code: I have coded the following using REST API to connect to Salesforce. Following code is from the URL to get Schema or fields of AccountTeamMember (standard) object after establishing connection with salesforce org through RESTAPI:
String schemaUrl = instanceurl + "/services/data/v54.0/sobjects/AccountTeamMember/describe";
log.info("schemeaUrl " + schemaUrl);
String responseString = "emptyschema";
Header printHeader = new BasicHeader("X-PrettyPrint", "1");
Header oAuthHeader = new BasicHeader("Authorization", "OAuth " + accesstoken);
HttpGet schemaHttpGet = new HttpGet(schemaUrl);
schemaHttpGet.addHeader(oAuthHeader);
schemaHttpGet.addHeader(printHeader);
int count = 0;
response = httpClient.execute(schemaHttpGet);
log.info("after executing HTTPGet : " + response);
int iStatusCode = response.getStatusLine().getStatusCode();
log.info("iStatusCode : " + iStatusCode);
if (iStatusCode == 200) {
HttpEntity httpEntity = response.getEntity();
log.warn("httpEntity : " + httpEntity);
if (httpEntity != null) {
log.info("before responseString " + responseString);
responseString = EntityUtils.toString(httpEntity);
log.info("after responseString " + responseString);
Here after running this code, I got all fields of AccountTeamMember (a standard object associated to the Account object) in Json format, if I keep AccountTeams enable, through RestAPI I am able to get all fields as json object and if disable then 404 status code.
So here is my question: Is there any other way to know AccountTeams is enabled for Account object other than this 404 status code and manually login to Salesforce org?