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

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

(1) ShareShare
ReportReport
Posted on by 244
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
 
I have the same question (0)
  • Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 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
    244 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
    244 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

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 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans