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