Options

How can I Upload Text & Files to a REST API using the CU1297?

guiyoteguiyote Member Posts: 12
edited 2019-07-23 in NAV Three Tier
I need to Send 2 text parameters and a text file (in the body of Request) to a WS Rest using the POST method.
I am testing with the codeunit 1297, that have two functions to add content to the body (AddBodyAsText and .AddBody), but it is not possible to use both simultly since it gives an error:A call to System.IO.FileStream.CopyTo failed with this message: Cannot access a closed Stream.
Object name: 'destination'.

I interpret that the body of the request is closed at the moment that the second AddBody function is invoked
Sign In or Register to comment.