I'm trying this SOQL query in the REST Explorer:

/services/data/v39.0/query/?q=SELECT+AssigneeId+PermissionSet.Id+Assignee.Name+PermissionSet.Name+PermissionSet.Label+FROM+PermissionSetAssignment+WHERE+PermissionSet.Id=[AN ID]

[AN ID] is formed like '0000'

It's saying that it's malformed at Assignee.Name.

I don't know where I'm going wrong with this query as it works in the developer console.


Your fields must be comma delimited. If you were to run the query listed in your URL in the Developer Console, it would translate to:

SELECT AssigneeId PermissionSet.Id Assignee.Name PermissionSet.Name PermissionSet.Label
FROM PermissionSetAssignment WHERE PermissionSet.Id='0000'

Of course this query will not work. The properly delimited query would be:

SELECT AssigneeId, PermissionSet.Id, Assignee.Name, PermissionSet.Name, PermissionSet.Label
FROM PermissionSetAssignment WHERE PermissionSet.Id='0000'

And the properly formed URL would be:


Note that the SOQL Developer Guide makes this point clear in SOQL SELECT Syntax (emphasis mine):


Specifies a list of one or more fields, separated by commas, that you want to retrieve from the specified object. The bold elements in the following examples are fieldlists:

SELECT Id, Name, BillingCity FROM Account
SELECT count() FROM Contact
SELECT Contact.Firstname, Contact.Account.Name FROM Contact

You must specify valid field names and must have read-level permissions to each specified field. The fieldList defines the ordering of fields in the query results.

fieldList can include a subquery if the query traverses a relationship. For example:

SELECT Account.Name, (SELECT Contact.LastName FROM Account.Contacts)
FROM Account

The fieldlist can also be an aggregate function, such as COUNT() and COUNT(fieldName), or be wrapped in Translating Results.

| improve this answer | |
  • Worked! I wish the documentation on the Salesforce would say that. – akcorp2003 Mar 20 '17 at 18:40
  • @akcorp2003 Ah, but it does. See my updated answer for citation there. – Adrian Larson Mar 20 '17 at 18:44
  • Whoops. I meant the documentation for REST API. It's obvious that a SOQL statement has commas but the REST API documentation only shows a sample query with only 1 selected field. developer.salesforce.com/docs/atlas.en-us.api_rest.meta/… – akcorp2003 Mar 20 '17 at 21:30

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.