I was trying to get the "User" object's fields list, So I tried to do it using an SOQL query via REST API:

Select QualifiedApiName From FieldDefinition where EntityDefinition.QualifiedApiName='user' order by QualifiedApiName

and I get a list of 70 fields. enter image description here

I execute the same query via Tooling API and I get a list of 95 fields. Here is the Tooling API query:


enter image description here

So, I would like to know what is the differences between REST API and Tooling API in this case, why I'm getting different results with the same query, and what are the missing fields in the SOQL query result.

Thanks in advance!

1 Answer 1


Depending on what you're looking to do, you have to decide which API to use as they all have different purposes and, as you noted, may expose different fields, objects, endpoints, etc.

If you were to look directly at the metadata of a User - you'd see there's even more fields not being returned in either situation that has a big importance to their configuration (ex. all the UserPreferencesxxx).

You may want to take look at sObjectDescribe


Which would return fields that would return what's visible in the UI as well as the preferences. Be aware, this also doesn't include fields the Tooling API is exposing (though those shouldn't have any value).

Back to your question - the fields not returned in a query against FieldDefinition (in apex, SOQL) for User are not visible in Setup in the UI either. Why is it exposed in the Tooling API? When to Use Tooling API

Use Tooling API when you need fine-grained access to an org’s metadata

Because Tooling API allows you to change just one element within a complex type, it can be easier to use than Metadata API. Other use cases include:

  • Source control integration
  • Continuous integration
  • Apex classes or trigger deployment

Since Tooling API is more concerned with building on the platform, it's not surprising it may expose other fields not visible in the UI that have no functionality/customizability through that means.

An easier way to see this difference is opening up the Developer Console and running that same query - once with Use Tooling Api checked and another without it checked.

Based on a dev org I had running, these were the "extra" fields Tooling API returned for User on FieldDefinition. Feel free to add/call out any others you noted:

  • BannerPhotoId
  • DataStorageUsage
  • EndDay
  • HasRollups
  • IsSelfServiceUser
  • IsSystemControlled
  • LockoutDate
  • PasswordAnswer
  • PasswordExpirationDate
  • PasswordMd5
  • PasswordQuestion
  • PasswordQuestionType
  • PasswordResetAttempt
  • PasswordResetLockoutDate
  • PasswordResetType
  • PasswordSha256
  • ProfilePhotoId
  • StorageUsage
  • SuAccessExpirationDate
  • SuOrgAdminExpirationDate
  • UserSubType
  • WirelessTrialExpirationDate
  • WirelessTrialExpirationNotifyDate
  • WorkspaceId

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .