Plugging in the Management API for managing user records, and I notice that the docs claim that every field is optional. Is that really the case? If so, that implies that the empty JSON object - {} - is a perfectly valid response for getting user details.
If it’s not the case, is there anything that tells me which fields I can guarantee will always be present? I assume things like user_id and created_at are always going to be present, but the API docs say otherwise.
The reason that all response fields are considered optional is because you can request a response with only specific fields. The important note from doc of the fields param:
Fieldsstring Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.
This option makes it possible for every field to be optional in the response. As an example, you could exclude the user_id field from the response, even though the user’s profile contains a valid user id, making user_id an optional response field.
I agree though, it is confusing to have every field labeled optional.
Ah - I’d missed that! However, is there anything that tells the fields that are guaranteed/optional if you don’t exclude them? If not, could I suggest that it would be useful?
I can’t find anything that indicates which fields are guaranteed in the user’s profile. I’d be happy to submit that feedback to our docs team. Thanks for the feedback!