Hi,
In BC16 I'm consuming an external REST API.
To make a request, I use the HttpClient datatype.
I'm struggling to add the http-header Date. It's unclear to me what is the correct format for the date header value as it is not documented.
Already tried following date formats:
1/ httpHeaderDate := FORMAT(CurrentDateTime(), 0, 9); //example: 2020-09-07T14:24:57.611Z
=> The format of value '2020-09-07T14:24:57.611Z' is invalid
2/ a suggestion from stackoverflow for C# development
currDateTime := currentDateTime; // currDateTime is a dotnet variable of datatype DateTime
httpHeaderDate := currDateTime.ToString('ddd, dd MMM yyyy HH:mm:ss zzzz');
=> The format of value 'ma, 07 sep 2020 14:33:49 +02:00' is invalid.
3/ another suggestion from stackoverflow for C# development
currDateTime := currentDateTime; // currDateTime is a dotnet variable of datatype DateTime
httpHeaderDate := currDateTime.ToString('yyyy-MM-ddTHH:mm:ssZ');
=> The format of value '2020-09-07T14:36:22Z' is invalid.
////////
var
Client: HttpClient;
httpHeaderDate: Text;
begin
Client.DefaultRequestHeaders.Add('Date', httpHeaderDate);
end;
///////
Does anyone have an idea?
Regards,
Frank
0
Answers
seems similar to your 2nd suggestion, not sure what the "ma" is supposed to stand for in
'ma, 07 sep 2020 14:33:49 +02:00'
make sure its english.