4

I am running a SOQL query through REST API.

The entire process flows as follows:

  • Whenever user tries to access our site from Salesforce I retrieve the Salesforce Session ID through SAML.

  • With the session_id I query back Salesforce Using REST API.

    def find_by_soql(query,session_id) cmd = "curl #{APP_CONFIG[:salesforce_api_url]}query/?q=#{query}" cmd << " -H 'Authorization: Bearer #{session_id}'" res = System(cmd) return res end

Where query string would look like (Before HTML escaping) :

select my_sf_ns__XYZ__c  
from my_sf_ns__XYZ_TAB__c 
where id in  (select my_sf_ns__XYZ_TAB__c  
              from my_sf_ns__ABC_XYZ__c  
              where my_sf_ns__ABC__c in  ('0019000000PmMisAAF','0019000000QKhjWAAT') )

This query works perfectly fine for System Administrator Profile but fails for a Profile which is Cloned from System Administrator. Both the Profiles has access to XYZ_TAB , ABC_XYZ and ABC Objects.

I couldn't find out what I am missing from configuration side. But I have few doubts on the Salesforce behaviour.

Please help me understanding whether these may be the reasons for failure.

1.REST API and SOQL

Is there any profile level restriction on Salesforce REST API to run SOQL ?

Is that API Access for new Profile will take some time to activate ?

2.Developer Org and SOQL

I am testing this in the same Platform where I am developing the Managed package. Will these be an issue causing Custom Objects be visible only to System Administrator on Developer Org ? Because whenever I install this manage package on other Orgs it asks for Profile to allow and all other access control options.

If so, is there a way to enable it for these profiles too on Developer Org ?

  • When you say fails: is it giving an error message or is the query not returning any values? – Sam Aug 28 '13 at 8:22
  • I am getting an error message as below: [{"errorCode"=>"INVALID_TYPE", "message"=>"\nmy_sf_ns__XYZ__c from my_sf_ns__XYZ_TAB__c\n ^\nERROR at Row:1:Column:47\nsObject type 'my_sf_ns__XYZ_TAB__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."}] – karthikselva Aug 28 '13 at 8:38
  • Looks like a permissions problem - your user is able to access the REST API, but they can't see that object type. One thing you could try is a Describe Global call to see what SObjects that user can see. – metadaddy Aug 28 '13 at 19:00
  • I tried creating a new Profile with Standard User and it works immediately. I guess there was some time lag to activate API Access for other profiles. I am using free developer edition so these profile updations job might have been pushed later. – karthikselva Aug 29 '13 at 12:10
1

When we are creating a Managed package in our DE org, it was prompting for list of roles who can access this package inside the Development Org.This appears only once.

This prompt also appears on first time, when we install the Package in other Orgs.

Couldn't find a way to enable it post creation of Managed package.

But checking the necessary Profiles on creation of Managed Package helped me fix this when I tried creating the same Managed Package from other DE Org.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.