在虚幻引擎中使用Postman代码?
我正在尝试学习如何在虚幻引擎中使用 VARest。但每个教程都使用单个 URL,而不是通过“构造 Json 对象”来输入 JSON。我的 API 有多种功能,我正在尝试使用名为“readPlayerWallet”的功能。当我查看 Postman 生成的 cURL 代码时,我得到以下信息:
curl --location --request
POST '---' \
--header 'Authorization: ---
--header 'Content-Type: application/json' \
--data-raw '{"query":"query readPlayerWallet ($playerGameId: String!, $network: String)
{\n readPlayerWallet (playerGameId: $playerGameId, network: $network) {\n
wallets {\n id\n type\n publicKey\n
privateKey\n createdAt\n balance\n }\n info {\n
status\n message\n }\n }\n}","variables":
{"playerGameId":"idtest","network":"---"}}'
Postman 返回一个以结尾的 JSON 文件,
"message":"success"}}}}
所以我的虚幻蓝图看起来像这样(Set Text 的 exec 连接到 RestCallback,它在我截取屏幕截图时刚刚中断):
但是文本消失了,并且不会触发 isNull,所以我猜它只是空的。 为什么?我该如何解决这个问题?
I'm trying to learn how to use VARest in Unreal Engine. But every tutorial uses a single URL and not a JSON input by using "Construct Json Object". My API has multiple functions, and I'm trying to use the one called "readPlayerWallet". When I view the cURL code generated by Postman, I get this:
curl --location --request
POST '---' \
--header 'Authorization: ---
--header 'Content-Type: application/json' \
--data-raw '{"query":"query readPlayerWallet ($playerGameId: String!, $network: String)
{\n readPlayerWallet (playerGameId: $playerGameId, network: $network) {\n
wallets {\n id\n type\n publicKey\n
privateKey\n createdAt\n balance\n }\n info {\n
status\n message\n }\n }\n}","variables":
{"playerGameId":"idtest","network":"---"}}'
And Postman returns a JSON file that ends with
"message":"success"}}}}
So my Unreal blueprint looks like this (Set Text's exec is connected to RestCallback, it just broke while I was taking the screenshot):
But the text disappears, and doesn't trigger isNull, so I guess it's just empty.
Why? How do I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,拉取响应节点并使用“to string”将其转换为字符串。这将帮助您检查是否首先获得完整的 json 文件。
如果不查看完整的 json 文件,我无法确定。您是否检查过消息字段是否直接是响应对象的子对象,或者它是否位于数组字段或另一个对象字段中。如果按层次结构它有一个父数组或对象,则必须首先调用它......然后从该对象中您必须使用“获取字符串字段”。
接下来,检查 json 是否是支持的格式。例如: Varest 不支持嵌套数组。
Firstly, pull the response node and convert that to string using "to string". This will help you to check if you are getting the complete json file first.
I can't say for sure without looking at the full json file. Have you checked if the message field is directly the child of the response object or if its within an array field or another object field. If by hierarchy it has a parent array or object, you have to call it first...then from that object you have to use "get string field."
Next, check if the json is of the supported format. For example: Nested arrays are not supported by Varest.