Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web API response xml language

I am having this simple POST url to which my clients will send a POST request.

http://mydomain.com/requests/request

POST Data:

<Request>
<OrderId>1E008921</OrderId>
<OrderName>MC1</OrderName>
</Request>

to which I respond by sending back them a XML

<SRequest>
<RequestedBy>Client 1 </RequestedBy>
<RequestName>Test Name</RequestName>
<RequestStatus>Success</RequestStatus>
<SRequest>

Now client wants the above XML in a different language (say French)

How to handle this ? How to send the response language preference in Web API ? specially with the POST scenario like this ? (Append a language string ? or what is the best practices ?)

like image 487
now he who must not be named. Avatar asked Sep 17 '26 09:09

now he who must not be named.


1 Answers

I suggest you either include it in URL: http://mydomain.com/fr/requests/request or use HTTP header like Accept-Language. You could read more in the answer to: Good way to changing language resources dynamically by request

like image 101
artplastika Avatar answered Sep 19 '26 02:09

artplastika



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!