procedute InitBody()
procedure AddKey(Name: Text; Value: Text)
procedure AddFile(KeyName: Text; FileName: Text; FileInStream: InStream)
procedure FinishBody()
procedure SetBoundary(NewBoundary: Text)
procedure GetBoundary(): Text
procedure GetDefaultBoundary(): Text
procedure GetMultiformData(var _TempBlob: Codeunit "Temp Blob")
procedure GetMultiPartFormDataContentTypeHTTPHeader() MultiPartFormDataContentTypeHTTPHeader: Text
procedure Example(WebAuthorization: Record WULWebAuthorizationNVX; URL: Text[250]; ExampleFileInstream: InStream) ResponseText: Text;
var
TempBlob: Codeunit "Temp Blob";
MultiformDataHelper: Codeunit WULMultiPartFormDataHelperNVX;
WebMessage: Record WULWebMessageNVX;
ResponseMessage: HttpResponseMessage;
MultiPartFormDataInStream: InStream;
begin
Commit();
MultiformDataHelper.InitBody();
MultiformDataHelper.AddKey('keyvalue1', 'myvalue');
MultiformDataHelper.AddFile('example_file', 'example.txt', ExampleFileInstream);
MultiformDataHelper.FinishBody();
MultiformDataHelper.GetMultiformData(TempBlob);
TempBlob.CreateInStream(MultiPartFormDataInStream);
WebMessage.CreateMessage(Enum::"Http Request Type"::POST, URL, MultiPartFormDataInStream);
WebMessage.AddWebMessageHeader(Enum::WULWebMessageHeaderTypeNVX::"Request Header", 'Accept', 'application/json');
WebMessage.AddWebMessageHeader(Enum::WULWebMessageHeaderTypeNVX::"Content Header", 'Content-Type', MultiformDataHelper.GetMultiPartFormDataContentTypeHTTPHeader());
WebMessage.AddWebMessageAuthorization(WULWebMessageHeaderTypeNVX::"Request Header", WebAuthorization);
Commit();
WebMessage.SendMessage(ResponseMessage);
Commit();
ResponseText := WebMessage.GetResponse();
end;
Finmatics Autonomous Accounting Interface for AI-driven document processing tool by Finmatics. More information AppSource |