Guaranteed fields for user records in API responses

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.

Cheers

Hi @sazzer,

Can you tell us specifically which endpoint you are referring to? E.G. POST/api/v2/users

I mean, that would have been helpful, wouldn’t it?

It’s “GET /api/v2/users/{id}”.

Cheers

1 Like

Thanks :grinning_face_with_smiling_eyes:

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:

Fields string 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? :slightly_smiling_face:

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!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.