I am using Oracle Apex 20.2.0.00.20 and ORDS to test a first REST service using this tutorial. Instead of the table in the tutorial I used the emp
table. It works until the point where I try to POST
data to the REST service using curl
.
I can successfully GET
the url https://myserver:8080/apex/mydb/myschema/emp/
and it returns the row JSON.
I used this curl
command from the DOS prompt using curl
for DOS to POST
data:
curl -X POST -H'Content-Type:application/json' -d'{"ename":"JUSTIN","job":"ANALYST","mgr":7839,"hiredate":"2020-04-30T22:00:00Z","sal":100000,"comm":null,"deptno":30}' https://myserver:8080/apex/mydb/myschema/emp/
This creates a row in the emp
table, but all the table columns are null except for the empno
column which gets populated via a trigger.
The output from curl
is:
{"empno":8003,"ename":null,"job":null,"mgr":null,"hiredate":null,"sal":null,"comm":null,"deptno":null,"links":[{"rel":"self","href":"https://myserver:8080/apex/mydb/myschema/emp/8003"},{"rel":"edit","href":"https://myserver:8080/apex/mydb/myschema/emp/8003"},{"rel":"describedby","href":"https://myserver:8080/apex/mydb/myschema/metadata-catalog/emp/item"},{"rel":"collection","href":"https://myserver:8080/apex/mydb/myschema/emp/"}]}
Also when I send through a job
that exceeds the column length it does not fail with status 500, but instead creates the row with nulls again.
Anybody know where the tutorial or I are going wrong?