Skip to main content

Notifications

Announcements

No record found.

Business Central forum
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
Categories:
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator 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,023 Moderator 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,023 Moderator 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans