Software AG Products 10.5 | Using API Gateway | APIs | API Scopes | Modifying API Scope Details | Exposing a REST API to Applications
 
Exposing a REST API to Applications
The API Provider can restrict the exposure of specific resources and methods of a REST API to other applications.
Consider you have a native REST API created in API Gateway with resources - Resource A, Resource B, and Resource C. You might want to expose Resource A and Resource C, and restrict the visibility of Resource B to other applications. You can use the Expose to consumers button to switch on the visibility of Resource A and Resource C and switch off the visibility of Resource B as required. Similarly, you can restrict the visibility of one or more methods within each individual resource.
If an application attempts to invoke the Resource C in the above REST API, API Gateway returns a HTTP response code 404.
By default, the Expose to consumers button is switched on for all resources and methods of the REST API. Once the API is activated, all of its resources and methods are exposed to registered applications. If you do not want a particular set of resources and methods, or a set of methods in a particular resource to be hidden for registered applications, switch off the Expose to consumers button in the REST API definition.
Note:
Be aware that API Gateway does not allow you to activate a REST API if none of the methods in the API are selected for exposing to other applications. You must select at least one method of the REST API to enforce runtime invocations.
*To expose a set of resources and methods of the REST API
1. Click APIs in the title navigation bar.
A list of APIs available in API Gateway appears.
2. Click the name of the required API.
This opens the API details page.
3. Click Edit.
If the API is active, API Gateway displays a warning message to let you know that the API is active.
4. Click Resources and methods.
This displays a list of resources and methods available in the API.
a. To select a resource, switch on the Expose to consumers button next to the resource URI.
You can select one or more resources to expose to other applications.
b. To select a method within the resource, click on the resource path. In the expanded list of methods, switch on the Expose to consumers button next to the method name.
You can select one or more methods to expose to other applications.
5. Click Save to save the updated API.
Activate the API, if it is not active, to put it into effect.