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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Reg: MIME type could not be found that matches the content type of the response

(1) ShareShare
ReportReport
Posted on by 248
Hi Techis,

I am working on POSTing a JSON value to the Business Central.

I am getting below error message



My code looks like below

var
                    http_req_mes: HttpRequestMessage;
                    http_cont: HttpContent;
                    http_clnt: HttpClient;
                    http_resp: HttpResponseMessage;
                    outputstring: Text;

                begin

                    http_req_mes.SetRequestUri('http://xxxxTestUsersRaj');
                    http_req_mes.Method := 'Post';

                    http_cont.WriteFrom(GeneratePayload());
                    http_req_mes.Content(http_cont);
                    http_clnt.UseWindowsAuthentication('xxx', xxxx');

                    if http_clnt.Send(http_req_mes, http_resp) then
                        if http_resp.IsSuccessStatusCode then begin
                            http_resp.Content.ReadAs(outputstring);
                            Message(Format(outputstring));
                        end else
                            Message('Error %1', http_resp.ReasonPhrase);
                end;

Also, I investigated that in POSTMAN in the ‘Body’ tab, if I don’t select the JSON in drop down same error occurs.



Let me know how I pass the above value in AL code.

Thanks
 
  • Saurav.Dhyani Profile Picture
    14,481 User Group Leader on at
    Hi,
     
    I didn't get the question completely. 
     
    But it seems you are not passing header to be in content header. 
     
    contentHeaders.Add('Content-Type', 'application/json');
     

    We are doing a series on API; you can watch it in YouTube - https://www.youtube.com/watch?v=AvJCkc0Xhxw
     
     
    We will be discussing your area going forward in same series.
     
     
    Regards,
    Saurav Dhyani
  • Verified answer
    Rajaneesh H Profile Picture
    248 on at
    Hi Techis,
     
    I have fixed above issue by adding the below code.
     
                        http_cont.GetHeaders(contenthdr);
                        if contenthdr.Contains('Content-Type') then contenthdr.Remove('Content-Type');
                        contenthdr.Add('Content-Type', 'application/json');
     
    Hope this might help someone like me!
     
    Happy Coding!
  • Rajaneesh H Profile Picture
    248 on at
    Thanks Saurav for your response!!
     
    I am big fan of you!! I love all your articles/videos/blogs related to BC.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 727 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 512 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 321 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans