有没有办法通过邮递员将文件上传到 GraphQL API?

编程入门 行业动态 更新时间:2024-10-27 14:26:35
本文介绍了有没有办法通过邮递员将文件上传到 GraphQL API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

目前我正在使用 Altair 将文件(在我的情况下仅用于图像)上传到我的 GraphQL API.但是,我所有的其他路由都存储在邮递员中,如果我可以只使用一个应用程序 - 邮递员 - 就​​可以了.

Currently I'm using Altair to upload files (in my case it's just for images) to my GraphQL API. However, all my other routes are stored in postman and it'd be nice if I could use just one application - Postman - for everything.

在 Altair 中,我可以简单地选择一个图像并将其存储为一个变量,我将其作为 GraphQL 上传字段的值.

In Altair I can simply select an image and store that as a variable that I put as the value for my GraphQL Upload field.

有谁知道 Postman 是否支持那个(或类似的)功能?

Does anyone know if Postman supports that (or a similiar) feature?

谢谢!

推荐答案

您可以使用 Form-Data 来做到这一点.

You can use Form-Data to do this.

关键:操作(这是用于查询/变异)

Key: Operations (this is for the query / mutation )

{"query":"mutation updateAvatar($avatar:Upload!) {\n updateAvatar(avatar: $avatar)\n}"}

键:映射(这是将文件映射到您的查询/变异)

Key: map ( this is to map the files to your query / mutation )

{"0": ["variables.avatar"]}

键:0(上传你的图片/文件等)

Key: 0 ( upload your image/file etc )

更多推荐

有没有办法通过邮递员将文件上传到 GraphQL API?

本文发布于:2023-10-29 04:18:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538705.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮递员   没有办法   文件上传   API   GraphQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!