web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Unable to send form data type request from business central

(0) ShareShare
ReportReport
Posted on by 107
Hi All,
Please help me, I am unable to send request to rest api facing issue but from post man its working
if
       
         CR
:= 13;
        LF := 10;
        NewLine += '' + CR + LF;

        // Request.GetHeaders(ContentHeaderL);

        TempBlob.CreateOutStream(PayloadOutStream);
       PayloadOutStream.WriteText('Content-Disposition: form-data; name="NAME"' + NewLine);
        PayloadOutStream.WriteText(NewLine);
        PayloadOutStream.WriteText('Eric TestWS' + NewLine);
        PayloadOutStream.WriteText('multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' + NewLine);
        PayloadOutStream.WriteText(NewLine);
        TempBlob.CreateInStream(PayloadInStream);
        // Write all bytes from the request body stream.

        Content.WriteFrom(PayloadInStream);
        Content.GetHeaders(ContentHeaderL);
        ContentHeaderL.Clear();
        ContentHeaderL.Add('Content-Length', '4096'); // this is required I think but when I keep this line request is aborting otherwise is request is success with error in response
        ContentHeaderL.Add('Content-Type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
        ContentHeaderL.Add('X-Kount-Api-Key', 'tokenvalue');

        Request.Method := 'POST';
        Request.SetRequestUri('https://risk.test.kount.net');
        Request.GetHeaders(Requestheaders);
        Requestheaders.Clear();
        Requestheaders.Add('Host', 'risk.test.kount.net');
        Request.Content(Content);
        Client.Send(Request, Response);


I have the same question (0)
  • Suggested answer
    Mahesh U Profile Picture
    433 on at

    Hi Venkatesh,

    At what line the debugger is stopping while getting this error? 

    Try to change the length from hard coded to using actual length and try. Thanks!

  • Venkateshwar_Indian Profile Picture
    107 on at

    client.send(request,response).

    if I dont put content length then post man response and business central response is same, when I use content length in post man request is successful but in bc it is failing with below error message

  • Verified answer
    Venkateshwar_Indian Profile Picture
    107 on at

    Hi Mahesh.

    As you told in Linkedin, for content type instead of giving value as direct number, taken value from tempblob.length it resolved the issue

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans