We have a new GET service endpoint which expects DateTime and Decimal data, among other parameters. For simplicity, this represent our request without any fix yet:
app.MapGet("saleEvent", async (string amount, string date) =>
{
long.TryParse(amount, out var requestAmount); //Use *culture* parameter
DateTime.TryParse(date, out var requestDate); //Use *culture* parameter
await DoSomething(requestAmount, requestDate);
});
We are receiving the data as strings, because a couple of our customers are based in different countries, with different formats, according to their culture.
We want to ask the customer to send their culture somewhere in the request, in order to be able to properly process the received data.
Well, here we have found many alternatives for our customers to include in their request, but I'm not sure which is the best or proper fit to do this:
accept-language header: Seems to indicate which culture they expect in the response, nothing to do with the parameters. Not our case as our response is just 200 (OK).
content-language header: Seems to indicate the language of the body. As we are not receiving a body, but a query string, I doubt we should use it.
One additional parameter in the query, like:
app.MapGet("saleEvent", async (string date, string amount, string culture)
A custom header for the same purpose.
Other recommendation was to receive the Date as UTC+0, but I think the customer should not be worried with removing the offset thing.
Is there any standar way to do this?