我有一个 API,它的响应如下:
"message": "Success!",
"user": {
"id": 17,
"first_name_kanji_or_hiragana": "Hiragana",
"last_name_kanji_or_hiragana": "Name",
"first_name_katakana": null,
"last_name_katakana": null,
"email": "user@example.com",
"image_path": null,
"email_verified_at": "2019-03-06 04:44:46",
"type": "admin",
"created_at": "2019-03-06 04:44:46",
"updated_at": "2019-03-06 04:44:46",
"deleted_at": null,
"full_name": "Name Hiragana",
"full_image_path": null,
"roles": [
每次我运行 API 时id
都会生成新用户。我想要做的是,我想在每次运行 api 时获取 id,然后想在下一个响应中使用该 id。我已经使用下面的代码来获取 id 但它不起作用
pm.test(responseBody, true)
var jsonData = JSON.parse(responseBody);
jsonData.data.user[0].id