I have created an API on using "SQL as a Web service" in "IBM Web Administration for i" to insert JSON input parameters into a table on the i.
It is identical to this example from:
https://developer.ibm.com/tutorials/creating-rest-apis-based-on-sql-statements/
INSERT INTO STUDENTDB
("studentID", "firstName", "lastName", "gender")
VALUES(?,?,?,?)
How can I modify the API to accept a JSON array to insert multiple input rows from a JSON array into the IBM i table?
JSON Input Example:
[
{
"studentID": "A1234567",
"firstName": "John",
"lastName": "Deere",
"gender": "male"
},
{
"studentID": "B9876543",
"firstName": "Jane",
"lastName": "Doe",
"gender": "female"
}
]
------------------------------
Rodney Gaylor
------------------------------