Rest Service POST error , how configure the POST parameter?

0
Post Operatation Config as following: parameter setting as following:   Response Microflow as following: import mapping as following: error :    it seems that the import mapping can not use the defined one, it may need a list import mapping. but I can not create i list import mapping in mendix pro V9.9.1
asked
2 answers
5

Hi yequan fang,

I am wondering if you have created The Import mapping which accepts only a object and not a list.

if you are using JSON structure for Import mapping make sure the Json Structure accepts List of objects. for Example :

{
    "foos" : [
        {
            "prop1":"value1",
            "prop2":"value2"
        },
        {
            "prop1":"value3", 
            "prop2":"value4"
        }
    ]
}
answered
1

To create a list import mapping: start the JSON with []. So this will give you:

[
    {
        "StudentRecord": {
            "Region": "",
            "year_before_last": 1999,
            "last_year": 2000,
            "current_year": 2022
        }
    }
]

Try it, you will see that this does take in a list and that you error will be gone.

By the way: A quick way to get an import mapping is by creating a message definition. Add your entity StudentRecord and click button ‘Generate mapping(s)’.

answered