Movatterモバイル変換


[0]ホーム

URL:


Send API requests from the Postman VS Code extension

The Postman VS Code extension enables you to create and sendHTTP andmulti-protocol requests, or yourrequest history. Use the Postman Console in the VS Code extension todebug and troubleshoot issues with your requests. It also supportscreating code snippets from your API requests for various languages, such as Node.js or cURL. You can also usecookies with the VS Code extension.

Requests sent in the Postman VS Code extension appear in your workspace’s request history in both the VS Code extension and the Postman app.

Send HTTP API requests

To create and send an HTTP request, do the following:

  1. Select a workspace from the workspace dropdown list in the sidebar.

  2. ClickDown Large icon in the request dropdown list in the sidebar, then selectHTTP to use Postman’s REST client.

    The request dropdown list

    If you selectedHTTP from the request dropdown list, you can create another HTTP request by clickingNew HTTP Request in the sidebar.

  3. Enter your request’s details.

  4. ClickSend.

To learn more about creating and sending HTTP requests in Postman, seeSend API requests and get response data in Postman.

You can also use thePostman: Create a new HTTP Request command from theCommand Palette to create a request.

Send multi-protocol API requests

When you create a request, clickDown Large icon in the request dropdown list. Then, selectWebSocket orgRPC to create a WebSocket or gRPC client.

WebSocket

To create a WebSocket request, do the following:

  1. Enter the WebSocket server URL. A WebSocket URL begins withws:// orwss://.
  2. ClickConnect.
  3. To disconnect your WebSocket request’s connection, clickDisconnect.

To learn more about creating and sending WebSocket requests in Postman, seeCreate a WebSocket Request.

gRPC

To create a gRPC request, do the following:

  1. Enter a URL intoServer URL.
  2. Click theMethod selection dropdown and select the method you want to invoke.
  3. Configure aservice definition.
  4. ClickInvoke.

To learn more about creating and sending gRPC requests in Postman, seeInvoke a gRPC request in Postman.

Send API requests from your history

You can send requests that were sent with the Postman VS Code extension or the Postman app.

  1. Select a workspace from the workspace dropdown list in the sidebar.
  2. ClickHistory iconHistory.
  3. Select a request from your history, and edit the request if you’d like.
  4. ClickSend.

Store variables

You can store and reuse variables in the VS Code extension. Each collection, environment, and global variable has aninitial value and a current value you can define for different uses. You canset a global or environment variable as secret type, masking the initial and current values. You can also learn more aboutsharing variable values with your team.

The steps for defining and sharing variable values are different in the Postman app. Learn aboutvariable values in the Postman app.

Variable values

Define the current value for a variable to use it locally with your requests. You can define the initial value for a variable to share it with your team and use it with Postman features that run on the cloud. Make sure you understand the differences between current and initial values before adding your own data.

  • Initial value - The initial value is synced to the Postman cloud and shared with your team. The initial value is also used when sending requests from scheduled collection runs, monitors, the Postman CLI, and Newman. Learn more aboutsharing variable values in the VS Code extension.

  • Current value - The current value is only available locally in your instance of Postman and used to send requests. It isn’t synced to the Postman cloud. Current values enable you to develop and test using private credentials or experimental values, without risk of exposing sensitive data to others on your team. Learn how todefine a current value for your variables.

Set a variable as secret type

You can set the variable type for global and environment variables as default type or secret type. When you create a variable, its type is automatically set to default type. You can set the variable to secret type to mask the initial and current values.

  • Default type - Default type is automatically assigned to variables. This type displays as plain text and doesn’t have extra properties.

  • Secret type - Secret type masks the initial and current values. This helps you avoid unintentionally sharing sensitive tokens, for example, during screen sharing or live streaming.

To set a variable to secret type, click theType dropdown list next to a global or environment variable, and selectsecret. To change the variable back to default type, click theType dropdown list, and selectdefault.

Postman recommends that you use yourPostman Vault to store sensitive data, such as API keys, as encrypted vault secrets. Only you can access and use values associated with your vault secrets, and they aren’t synced to the Postman cloud.

Share variable values

Provide an initial value for a variable to sync its value with the Postman cloud and share it with your team. Even if you’ve shared an initial value, you can continue to update your current value without affecting the initial value.

You can choose to sync your current value with the Postman cloud. Enter a new initial value or you can persist your current value, sharing it with your team. To persist the current value to the initial value, clickOptions iconView more actions next to a variable and selectPersist. This updates the variable’s initial value based on your current value.

You can also reset your current value, returning it to the value shared in the initial value. ClickOptions iconView more actions next to a variable and selectReset.

To persist or reset all variables, clickOptions iconView more actions at the top of the column, then selectPersist all orReset all.

Troubleshoot with the Postman Console

You can use the Postman Console totroubleshoot your requests. You can also use the Console to debugpre-request scripts andtests scripts, logging output to the Console. To open the Postman Console, clickConsole iconOpen Postman console at the top of the sidebar.

The Postman Console option

Generate code snippets

You can convert an API request into a code snippet in the language of your choice. Available languages and frameworks include cURL, Node.js, Python, and more.

To generate a code snippet, open an HTTP request, then clickCode (belowSend). Select alanguage or framework from the dropdown list, then copy the code snippet to your clipboard.

Use cookies

You can view and edit cookies associated with different domains. You can then use the cookies stored in the cookie jar when sending HTTP requests in Postman.

To manage cookies in the Postman VS Code extension, open an HTTP request, then selectCookies (belowSend).

You can also open the cookie editor with thePostman: Open cookies editor command in theCommand Palette.

To learn more about using cookies in Postman, seeCreate and capture cookies using Postman’s cookie manager.

Last modified: 2025/08/22



[8]ページ先頭

©2009-2025 Movatter.jp