Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Bad Request error in Business Central API

Posted on by 170

Hi all,

I am having a strange issue with Business Central API. below is the case.

I have developed a codeunit in business central on-cloud with multiple functions and published as Web Service. Most functions receives parameter and return the values accordingly. However, i am having issue with one of the functions. It receive the parameters and process the values accordingly within Business Central. 

While making the API call to this function, it says "Bad Request". below is the function and parameter. i am using OData API url to call these methods.

procedure UpdateEventsAfterIntegration(Entry_No: Text[50]; Status: Text[50]; Message: Text[250])
begin
        Message(Entry_No + Message);
end;
Postman API Call:
7587.pastedimage1652163991488v1.png
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Bad Request error in Business Central API

    Yes, Good to know that it has been resolved,

    Now you can please close this thread.

  • Sunil1991 Profile Picture
    Sunil1991 170 on at
    RE: Bad Request error in Business Central API

    Hi Nitin,

    I got the issue and resolved it.

    Basically, first latter of parameter names should starts with small letter as below. earlier it was starting with Capital letter.

    procedure UpdateEventsAfterIntegration(entry_No: Text[50]; status: Text[50]; txtMessage: Text[250])

    begin

           Message(entry_No + txtMessage);

    end;

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Bad Request error in Business Central API

    Please share your code here.

  • Sunil1991 Profile Picture
    Sunil1991 170 on at
    RE: Bad Request error in Business Central API

    Hi Nitin,

    Thanks for your input. however, i tried as you suggested and still having the same error.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Bad Request error in Business Central API

    Hi Sunil Kumar ,

    Can you please change your 3rd parameter name to something else? Because you are now using standard keyword name "Message" please replace it with like MsgStr: Text[250]

    and used the same parameter like below.

    Message(Entry_No + MsgStr);

    And then please try again.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans