配置 Postman 以进行媒体服务 v2 REST API 调用Configure Postman for Media Services v2 REST API calls

备注

不会向媒体服务 v2 添加任何新特性或新功能。No new features or functionality are being added to Media Services v2.
查看最新版本:媒体服务 v3Check out the latest version, Media Services v3. 另请参阅从 v2 到 v3 的迁移指南Also, see migration guidance from v2 to v3

本教程演示如何配置 Postman,以便可以使用它调用 Azure 媒体服务 (AMS) REST API。This tutorial shows you how to configure Postman so it can be used to call Azure Media Services (AMS) REST APIs. 本教程说明如何将环境和集合文件导入到 PostmanThe tutorial shows how to import environment and collection files into Postman. 集合包含调用 Azure 媒体服务 (AMS) REST API 的 HTTP 请求的分组定义。The collection contains grouped definitions of HTTP requests that call Azure Media Services (AMS) REST APIs. 环境文件包含集合使用的变量。The environment file contains variables that are used by the collection.

此环境和集合在演示如何使用 Azure 媒体服务 REST API 实现各种任务的文章中使用。This environment and collection is used in articles that show how to achieve various tasks with Azure Media Services REST APIs.

必备条件Prerequisites

  • 安装 Postman REST 客户端,以便执行一些 AMS REST 教程中所示的 REST API。Install the Postman REST client to execute the REST APIs shown in some of the AMS REST tutorials.

    我们使用的是 Postman,但任何 REST 工具都适用。We are using Postman but any REST tool would be suitable. 其他适用的工具有:具有 REST 插件的 Visual Studio Code 或 Telerik Fiddler 。Other alternatives are: Visual Studio Code with the REST plugin or Telerik Fiddler.

配置环境Configure the environment

  1. 创建一个包含 AMS 教程中所用环境变量的 .json 文件。Create a .json file that contains the environment variables used in AMS tutorials. 命名该文件(例如,AzureMediaServices.postman_environment.json)。Name the file (for example, AzureMediaServices.postman_environment.json). 打开该文件并从此代码清单粘贴用于定义 Postman 环境的代码。Open the file and paste the code that defines the Postman environment from this code listing.

  2. 打开 PostmanOpen the Postman.

  3. 在屏幕的右侧,选择“管理环境” 选项。On the right of the screen, select the Manage environment option.

    上传文件

  4. 从“管理环境” 对话框中,单击“导入” 。From the Manage environment dialog, click Import.

  5. 浏览并选择 AzureMediaServices.postman_environment.json 文件。Browse and select the AzureMediaServices.postman_environment.json file.

  6. 添加 AzureMedia 环境。The AzureMedia environment is added.

  7. 关闭对话框。Close the dialog.

  8. 选择 AzureMedia 环境。Select the AzureMedia environment.

    上传文件

配置集合Configure the collection

  1. 创建一个包含 Postman 集合的 .json 文件,该集合包含将文件上传到媒体服务所需的所有操作。Create a .json file that contains the Postman collection with all the operations that are needed to upload a file to Media Services. 命名该文件(例如,AzureMediaServicesOperations.postman_collection.json)。Name the file (for example, AzureMediaServicesOperations.postman_collection.json). 打开该文件并从此代码清单粘贴用于定义 Postman 集合的代码。Open the file and paste the code that defines the Postman collection from this code listing.

  2. 单击“导入” 导入该集合文件。Click Import to import the collection file.

  3. 选择 AzureMediaServicesOperations.postman_collection.json 文件。Choose the AzureMediaServicesOperations.postman_collection.json file.

    上传文件

后续步骤Next steps

查阅上传资产一文。Check out the upload assets article.