You need to sign in to do that
Don't have an account?
yajiv
Access the foreign key ProfileId in User using the REST API and SOQL query
Hi,
I am trying to access the foreign key ProfileId in User using the REST API but I get an error on the ProfileId. How do I get the ProfileId for the User using the SOQL query below for the REST calll to the User? I have already logged in and am passing the accessToken as the Authorization Header.
HttpClient httpclient = new HttpClient(); GetMethod get = new GetMethod("https://" + instanceUrl + "/services/data/v20.0/query"); // set the token in the header get.setRequestHeader("Authorization", "OAuth " + accessToken); // set the SOQL as a query param NameValuePair[] params = new NameValuePair[1]; //WHERE IsActive = true params[0] = new NameValuePair("q", "SELECT Email,Id,ProfileId FROM User LIMIT 1");
TIA,
Vijay
Hi Vijay,
What error are you seeing (HTTP status/content)? Do you see the same error if you omit ProfileId? Are you sure that your test user has permission to view ProfileId?
I just ran the same query from a PHP test script and it works fine (reformatted for clarity):
Cheers,
Pat
IIRC, ProfileId will only be available if your user has view setup (and therefore can see profiles)