Managing Multiple Objects in API Using the POST Method

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Albert
Posts: 16
Joined: Tue Dec 26, 2023 12:43 am

Managing Multiple Objects in API Using the POST Method

Post by Albert » Fri May 10, 2024 1:37 am

Hello,

I've created an API using VL WEB, and I'm trying to use the POST method to insert JSON data. However, I'm facing an issue where only the first part of the JSON (the header) is being inserted. I'd like to insert the header into one file, then loop through the JSON details and insert them into another file.

Objects définition :
Image2.png
Image2.png (47.09 KiB) Viewed 16623 times
Image1.png
Image1.png (12.26 KiB) Viewed 16623 times

Code source methode POST :
codeAPI.PNG
codeAPI.PNG (169.7 KiB) Viewed 16623 times

request with POST methode :
{
"FHKZT1": "9600014",
"FHAMK5": "tt1",
"FHSWDA": 0,
"FHSTDA": 0,
"FHK1T1": "",
"FHLIB1": 0,
"FHC5MP": 0,
"FHLJB1": 0,
"FHALT1": "",
"FHHMDA": 0,
"FHAFTM": 0,
"R_MA108": [
{
"A2ISK8": "9600014",
"A2A4DA": 20140524,
"A2AQDA": 0,
"A2AWK3": "754",
"A2BQK3": "319",
"A2AFBE": 100000.00,
"A2ACPC": 0.500000,
"A2AIBE": 0
},
{
"A2ISK8": "9600014",
"A2A4DA": 20140524,
"A2AQDA": 0,
"A2AWK3": "754",
"A2BQK3": "320",
"A2AFBE": 100000.00,
"A2ACPC": 0.500000,
"A2AIBE": 0
},
{
"A2ISK8": "9600014",
"A2A4DA": 20140524,
"A2AQDA": 0,
"A2AWK3": "754",
"A2BQK3": "323",
"A2AFBE": 50000.00,
"A2ACPC": 0.500000,
"A2AIBE": 0
}
]
}

Could you please help me understand how to achieve this with VL WEB ?

Thank you in advance for your assistance.

Best regards,

Post Reply