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...
Suggested Answer

BC integration - get JSON from POST request

(4) ShareShare
ReportReport
Posted on by 16
Hi Community, 
 
I'm trying to integrate BC cloud with a third party partner. The partner can send POST requests with a JSON body to an external endpoint. The JSON is structured and has nested objects. The goal is to fetch the JSON in BC and process it to extract the needed data.

I tried to achieve this using a web service with a procedure that has the JSON elements defined as Text parameters, but it's not working for the nested objects: "An unexpected 'StartObject' node was found for property named 'user' when reading from the JSON reader. A 'PrimitiveValue' node was expected.". 
 
Is there a way to make an endpoint in BC that gets the JSON body from the POST request? Do you have any examples?

Thank you!
I have the same question (1)
  • Suggested answer
    Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at
    Hi
    Are you using JsonObject or JsonArray?
     
    Best
    GR
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
  • CL-03091155-0 Profile Picture
    16 on at
    Hi, 
     
    Thank you both for your valuable information. However, the issue is not that I have troubles processing the JSON request in BC to read data from it, but rather getting the whole JSON payload in BC in order to process it.
     
    The process should be like this:  the external system sends a POST request with a JSON body to a BC endpoint, BC gets the JSON body and loops through its elements using the JSON BC data types to extract the data. Therefore, I'm not making a HTTP request from BC to an external endpoint, but rather I should receive a request in BC from an external system every time a resource was created or updated on their side.
     
    I cannot use an API page because the POST request has many nested elements, and for each element I would have to build a separate API page part. Example of a request: 

    {
        "field1": "value1",
        "field2": "value2",
        "element3": {
                   "field3.1":"value3.1",
                   "element3.2":{
                                          .....
                                         }
        },
        "element4": {
                   "field4.1":"value4.1",
                   "field4.2":"value4.2".....
        }
    .....
    }

    I tried publishing a BC web service having the following procedure and make the POST request to it, but it does not work:
    procedure HandleRequest(field1: Text; field2: Text; element3: JsonObject; element4: JsonObject)

    And making all parameters of type Text gives the mentioned error, because it finds a nested element instead of a string value: "An unexpected 'StartObject' node was found for property named 'element3' when reading from the JSON reader. A 'PrimitiveValue' node was expected.".
    procedure HandleRequest(field1: Text; field2: Text; element3: Text; element4: Text)

    Making any changes to the POST request we get from the external system is not an option in this case.

    Any other ideas would be much appreciated. 

    Thank you,
    CL
  • SG-15041333-0 Profile Picture
    2 on at
    I have the same use case. Did you find any solution?
     
    Thanks,
    Regards

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