The gRPC Request block
The gRPC Request block runs a gRPC request that you select from a collection. The request returns a response message, which the block sends through an output port along with any test results.
The gRPC Request block consumes one credit each time it runs in the Postman Cloud. To learn more, see How Flows consume credits.
Input
Send - If you connect another block to this input port, that block triggers the gRPC Request block to run. This connection is optional. The gRPC Request block will run when the flow runs and all required inputs have values.
Variables - If the selected request obtains values from variables, those variables will be listed here. Requests can reference variables in the server URL, message, metadata, authorization settings, and scripts.
If a value in the request was set without using a variable:
-
No variable will be listed for it in the gRPC Request block.
-
There is no way to override its value from a flow.
To learn how to set or override these variable values, see Setup.
Outputs
Success - Sends the response of a successful request and any passed or failed test results. To succeed, a request must return the OK gRPC status code.
Fail - Sends the response of an unsuccessful request and any passed or failed test results. A request will fail if it returns any gRPC status code other than OK.
Setup
Search for requests - Click to open a dropdown list showing all the collections in your workspace. Select a collection, then select a request.
The request’s server URL, service definition, and method come from the request you select. To change them, edit the request in its collection. To learn more, see Manage gRPC APIs using Postman.
Variables - To assign a value to a request’s variable, use either of the following methods:
-
Connect another block’s output port to the variable’s input port.
-
Click
Add data blocks to Insert a data block inline.
You can also use these methods to assign values to environment variables or dynamic variables used in a request. If your request uses dynamic variables, the dynamic variables will work as usual in your flow. If you want to override their values, use one of the value assignment methods to assign the values you prefer.
Additional settings
Allow scripts to update environment variables - Requests can change environment variables’ values with scripts. When enabled (default), if before-invoke, on-message, or after-response scripts change an environment variable’s value, the new value persists after the gRPC Request block completes its task. Turn this off to prevent those changes from persisting after each time the block completes its task.
Ignore test failures when routing - When enabled (default), the gRPC Request block routes any response with an OK status code through the Success output port even if it includes failed tests. Turn this off to route responses through the Fail output port if any tests fail.
Update environment variables with scripts
Requests can change environment variables’ values with scripts. You can configure the gRPC Request block so that environment variable values changed by before-invoke, on-message, and after-response scripts persist or reset when the block’s run completes.
When changes persist, the new values stay in the environment after the block runs, throughout the rest of the flow and after the flow run ends. This works the same as running the request directly in Postman.
By default, script-changed values persist in gRPC Request blocks.
Persistent changes to environment variables only work when you run a flow in Postman. Deployed flows don’t support persistent changed values for environment variables.
To turn persistent changes to environment variables on or off, do the following:
-
Click the gRPC Request block.
-
Expand Additional settings.
-
Turn the Allow scripts to update environment variables toggle on or off.
Left is off,
right is on.