postman如何调出graphql
时间: 2023-09-12 10:04:29 浏览: 49
要使用Postman调用GraphQL API,您需要按照以下步骤操作:
1. 打开Postman应用程序。
2. 创建一个新的请求,选择HTTP方法为POST。
3. 在请求URL中输入GraphQL API的端点URL。
4. 在请求头中添加以下内容:
- 键:Content-Type
- 值:application/json
5. 在请求体中创建一个JSON对象,包含GraphQL查询。
6. 在JSON对象中添加一个键为"query"的字段,其值是您的GraphQL查询语句。
7. 点击发送按钮以发送请求,并从API获取响应。
请注意,您需要在请求体中使用JSON格式来编写GraphQL查询语句。如果您需要使用变量或片段,可以将其添加到JSON对象中的相应字段中。
引用中提到了使用Postman发送GraphQL请求。提供了一篇关于GraphQL入门指南的文章,其中包括了使用Postman调用GraphQL的示例代码。在中提到了启用GraphiQL,这是一个内置的IDE,用于在浏览器中编写和测试GraphQL查询。但是,使用Postman也是一种常见的调用GraphQL API的方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [graphql_普通英语GraphQL指南](https://blog.csdn.net/cumichun6193/article/details/108156991)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]