A
A
Alexey Kalenchukov2020-09-30 21:38:46
API
Alexey Kalenchukov, 2020-09-30 21:38:46

Return or not the value of empty fields?

There are fields 'user_id', 'country_id', 'city_id' which are returned by the API method blah blah blah.
The user's country and city may not be filled in, that is, country_id = 0 and city_id = 0. Which is
better, is it more correct to return these fields, with zeros or not return them at all in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2020-09-30
@delphinpro

When you design an API, among other things, you set the response schema. And all answers should be formed according to this scheme. Those. yes, fields must be returned filled with zeros (or null).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question