function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gabriel Costa 13Gabriel Costa 13 

Custom Object (from PropertyBase) not showing on REST API with server-to-server credentials

Hi,

I have custom objects created by PropertyBase and I'm making a query via REST api through this get request: 

https://MYORG.my.salesforce.com/services/data/v56.0/query?q=SELECT FIELDS(ALL) FROM pba__Property__c WHERE RecordTypeId='ID' LIMIT 200

When I put the auth token that is generated via OAuth2 Authorization with the web popup to login with my account, I can see the records. But when I tried to use the token generated with Client Credentials Flow for Server-to-Server I receive this error:

"message": "\nSELECT FIELDS(ALL) FROM pba__Property__c WHERE RecordTypeId='ID'\n                        ^\nERROR at Row:1:Column:25\nsObject type 'pba__Property__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.",
        "errorCode": "INVALID_TYPE"

I see that if I call default objects from Salesforce with this token I got results with no problem. What could be the reason? The 'Run as' user that is used for generate the token is different than the user that I use in the web popup to login. Could it be that? If so, where should I allow this user to see these custom objects? From what I searched the permissions seems to be the same that those that I have.