VSCODE REST客户端扩展名 - 从属性响应器JSON复杂对象中获取值
使用 Visual Studio Code 和 Rest 客户端扩展: 我正在调用返回 JSON 对象的端点。我试图获取该对象的“AccessToken”属性,但它不返回值。 可能做错了什么?
这是 .rest 文件
###LOGIN
# @nane loginrequest
POST https://someurl
content-type: application/json
{ "username":"someuser", "password":"somepassword", "refresh_token": null }
// THE RESPONSE IS:
//// {
// "Error": false,
// "Success": true,
// "Message": "Login ok.",
// "Data": {
// "IdToken": "xxxxx",
// "RefreshToken": "yyyyy",
// "AccessToken": "zzzzz",
// "ExpiresIn": 21600
// },
// "ResultCode": 200
// }
### VARIABLE RESPONSE TO FILL TOKEN
@authtoken= {{loginrequest.response.body.$.Data.AccessToken}
### VCloud Stores API Gateway . GetOrdersIds
GET https://someurl HTTP/1.1
Content-Type: application/json
Authorization: {{authtoken}}
Using Visual Studio Code and Rest Client Extension:
I am calling an endpoint that returns a JSON object. I'm trying to get the "AccessToken" property of that object, but it doesn't return a value.
What could be doing wrong?
This is the .rest file
###LOGIN
# @nane loginrequest
POST https://someurl
content-type: application/json
{ "username":"someuser", "password":"somepassword", "refresh_token": null }
// THE RESPONSE IS:
//// {
// "Error": false,
// "Success": true,
// "Message": "Login ok.",
// "Data": {
// "IdToken": "xxxxx",
// "RefreshToken": "yyyyy",
// "AccessToken": "zzzzz",
// "ExpiresIn": 21600
// },
// "ResultCode": 200
// }
### VARIABLE RESPONSE TO FILL TOKEN
@authtoken= {{loginrequest.response.body.$.Data.AccessToken}
### VCloud Stores API Gateway . GetOrdersIds
GET https://someurl HTTP/1.1
Content-Type: application/json
Authorization: {{authtoken}}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我觉得自己像个傻瓜……行尾缺少一个“}”,而且@nane也拼写错误。
感谢@timothy G.
I feel like a fool...it was a missing "}" at end of line and that the @nane was also misspelled.
thanks to @timothy G.