B
B
BonBon Slick2018-10-13 23:06:16
Software design
BonBon Slick, 2018-10-13 23:06:16

What is the best way to pass localization parameters to API?

It can be in the link api/en/user, but it can be in the headers x-localization.
Which approach to use when and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2018-10-13
@BonBonSlick

Depends on how caching happens. If the header is part of the cache then there is nothing wrong with that. In general, one of the postulates of the API is that when you GET at the same URL, you get the same resource and do not have different addresses for the same resource. Your resource is actually the same, just localized. Therefore, a header is a good move.
The case with localization in url is good where there is no other way to cache information

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question