Internal API Call

Internal API Call allows users to invoke an internal call based on the settings defined.

Example of use:

Imagine that, for a given API called "SearchSalesInformation", you need the request to undergo a simple login/password authentication. In this scenario, you already have an API for this sort of authentication, called "AuthenticateUser" which should be registered.

Since you already have an exposed API ("SearchSalesInformation"), as well as an API that performs authentication control ("AuthenticateUser"), there is no need to replicate the authentication logic into the flow of the first API. Instead, you can add the API Internal Call interceptor in the flow of the API "SearchSalesInformation", redirecting the requests to "AuthenticateUser". Based on what the authentication process returns — $call.contextVariables.get(“Variable Name”) — the interceptor will decide whether to continue or abort the process.

Configuring the interceptor

The images and text below present the information that must be informed to configure the interceptor.

internal api call
  • Variable Name: defines the name of the Internal API Call, unique per flow. The interceptor is retrieved inside the object $call.contextVariables.get(“Variable Name”) using the name informed here.

  • API: API to be invoked.

  • Revision: revision of the API to be invoked.

  • Resource: resource to be invoked.

  • Operation: operation to be performed.

You can only invoke an API that is deployed to the same environment as the API to whose flow you are adding the interceptor.

Going back to the APIs in the example of use above, to call the API "AuthenticateUser", it must be deployed to the same environment as the API "SearchSalesInformation", which is the one that contains the Internal API Call interceptor.

If you wish to invoke an API that is not deployed to the same environment, you must first deploy it. Remember that you can deploy an API to multiple environments. You can read more about deploying APIs here.

  • Preserve Query String: if checked, the query string present in the request will be transferred to the API invoked internally.

  • Query: allows the insertion of a query string.

  • Preserve Path Param: if checked, the path param present in the request will be transferred to the API invoked internally.

  • Path Param: allows the insertion of a path param.

  • Preserve Body: if checked, the body contained in the request will be transferred to the API invoked internally. This field is enabled when the method is different from GET.

  • Body: allows the insertion of a body. The field is enabled when the method is different from GET and the field Preserve Body is unchecked.

  • Preserve Headers: if checked, the headers present in the request will be transferred to the API invoked internally.

  • Headers: allows the insertion of headers.

How it works

The Gateway executes the Internal API Call interceptor, and the result is added to the Gateway object $call.contextVariables. To retrieve the result with a custom interceptor, use $call.contextVariables.get(“Variable Name”).

The call to $call.contextVariables.get will return a RestResponse object.

Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]