Invoke
The invoke policy sends a request to a backend service and returns its response.
The policy defines how the gateway connects to the target service. It lets you configure the HTTP method, connection and timeout settings, TLS behavior, request and response handling, and caching. It also supports gateway specific extensions such as service registry lookup and gateway level SSL configuration.
In IBM API Studio, this policy is identified by
the kind Invoke.
Example of a Invoke policy:
kind: Invoke
apiVersion: apim.ibm.com/v1
metadata:
name: "invoke"
version: 1.0
namespace: sample
spec:
input : request # optional to set the request for the invoke
output : response # optional to store response for the invoke
cache:
expire:
static:
seconds : 60
scope:
narrowScope : {} # wideScope
endpoint:
http:
verb: GET
statusException:
- pattern: '500'
target:
tlsClientProfile: tls_profile
url: 'https://localhost:3000'
urlType: 'plain' # plain, variables, jsonata
version: HTTP/1.0 # HTTP/1.1, HTTP/2
timeout: 60
compressRequest: "br" # "gzip", "br", "deflate", "none"
decompressResponse: false
followRedirects: false
chunkedUpload: false
persistentConnections: true
extensions:
webm-gateway:
apiVersion: api.ibm.com/v1
spec:
endpoint:
http:
target:
connectionTimeout: 300
nativeServiceTimeout: 400
sslConfig:
keyStoreAlias: ""
keyAlias: ""
trustStoreAlias: ""
serviceRegistryParameters:
- name: ""
value: ""
To use the Invoke policy, you can specify the following configurations:
| Type | Description |
|---|---|
spec |
Describes the configuration for the policy. This section includes:
|
cache |
Defines caching behavior. This section includes:
|
endpoint |
Defines the HTTP endpoint configuration. This section includes:
|
endpoint.http.target |
Specifies HTTP target properties. This section includes:
|
extensions.webm-gateway |
Provides gateway specific configuration. This section includes:
|