الخميس، 9 ديسمبر 2021

Inserting Data Using RESTful Service

Inserting Data Using RESTful Service

you will create a RESTful Service to insert data using the HTTP Method POST.

You will use the postman tool to test your RESTful Service and to verify the results.





In the empall Template, create a new POST Handler.



BEGIN
INSERT INTO EMP
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
VALUES
(:EMPNO,:ENAME,:JOB,:MGR,TO_DATE(:HIREDATE,'DD-MON-RR'),:SAL,:COMM,:DEPTNO);
htp.prn('employee '|| :EMPNO);
END;

In the postman tool to test the POST request, we have to set the Content-type to application/json. 

Click the Headers tab under the URL bar. 

Under the heading KEY, enter Content-Type, and for VALUE enter application/json.  



In the postman tool to test the POST request, click the Body tab, 
check raw, and enter the json code shown below. Click Send

{"EMPNO":124, "ENAME":"testinsert", "JOB":"IT_MANA", "MGR":7902, "HIREDATE":"25-JUN-15", "SAL":11, "COMM":22, "DEPTNO":10}



If the insert is successful, you will see the message below.

Check the new inserted record informationby using the GET handler created in the previous section, adding 124 to the end of the URL.

http://localhost:8080/ords/re/EMP_TEST/emp/124



 thanks

ليست هناك تعليقات:

إرسال تعليق

How to Solve Ords Issue : The request could not be mapped to any database.

 The request could not be mapped to any database.  Check the request URL is correct, and that URL to database mappings have been correctly c...