0% found this document useful (0 votes)
137 views

Restfull API Basics

1. Create a REST API using SICF Transaction and define an endpoint for it. 2. Create a REST handler class that inherits from CL_REST_HTTP_HANDLER and overrides the GET_ROOT_HANDLER method. 3. Create a REST resource class that inherits from CL_REST_RESOURCE and overrides the GET handler method to return a response. 4. Test the REST service using Postman by making a GET request and providing authentication details.

Uploaded by

raja reddy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views

Restfull API Basics

1. Create a REST API using SICF Transaction and define an endpoint for it. 2. Create a REST handler class that inherits from CL_REST_HTTP_HANDLER and overrides the GET_ROOT_HANDLER method. 3. Create a REST resource class that inherits from CL_REST_RESOURCE and overrides the GET handler method to return a response. 4. Test the REST service using Postman by making a GET request and providing authentication details.

Uploaded by

raja reddy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1. Create a Rest API using SICF Transaction.

2. SICF->default_host->sap->bc->rest->test ( it’s a test service whether it is working or not)


3. Right click on the service -> Activate Service -> Test Service
4. To allow incoming request at specific end point , we need to create an ICF node in Tcode SICF
5. Name of the service is ZSALES_LOAD and provide handler class as ZCL_REST_HANDLER
6. Create below 2 classes ,
7. One is Rest Handler Class and other one is Resource Class.
8. Create a ZCL_REST_HANDLER class by inheriting from the CL_REST_HTTP_HANDLER.
( Provide Super class in the below )

9. After saving the class we can see interfaces are imported into the interface TAB and interface
Methods into Methods TAB.

10. It will force to redefine IF_REST_APPLICATION~GET_ROOT_HANDLER method.

11. This method will handle incoming request at different resource paths you can define.
12. Before we add a new path lets create a REST Resource Class first ZCL_REST_RESOURCE_SALES .
13. Create a ZCL_REST_RESOURCE_SALES class by inheriting from the CL_REST_RESOURCE.
( Provide Super class in the below )

14. After saving the class we can see interfaces are imported into the interface TAB and interface
Methods into Methods TAB.

15. This class will handle incoming request. Let’s Redefine IF_REST_RESOURCE~GET handler method
and say hello.
Testing using Postman
Testing From Post Man Launce App

Get the Token Number to check the service .

1. Select GET Method from drop down


2. Select Authorizations Tab and Type as basic authorization and provide details.
3. Select Headers Tab from X-CSRF-Token as FETCH

You might also like