api - 如何使用 PostMan Rest 客户端使用 SessionID

标签 api postman

使用 POSTMAN REST 客户端从用户登录 session 的响应中获取“SessionId”。

GET请求的其他API调用如何使用sessionId?

最佳答案

对您的数据结构做出一些假设,将其存储为变量:

//parse the response body as JSON 
var data = JSON.parse(responseBody);

//create a global variable that can be reused in another call
postman.setGlobalVariable("sessionId", data.SessionId")

在调用另一个端点时使用:

http://www.example.com/ {{sessionId}}

关于api - 如何使用 PostMan Rest 客户端使用 SessionID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30192220/

相关文章:

xml - 如何在 Swagger 文档中添加 xml 示例

postman - 如何避免 postman 中的 "environment hell"?

javascript - 找出测试失败的原因

api - 我需要 REST API 包吗?

Python liburl2 超时;可以 ping 服务器正常,wget 工作正常;

javascript - postman /pm api sendRequest 命令 : how to wait till the response is back before populating the variable?

PHP cURL 请求返​​回 401,但适用于 Postman

laravel - 未找到类 'App\Http\Controllers\Api\Validator'

java - Google 天气 API 条件

java - Android ArrayList,如何获取ListView的onClick