Здравствуйте.
Работаю в программе Postman.
Из GET ответа нужно записать значение переменой totalElements в переменную и lastName пользователя 3 в другую переменную как это сделать?
Для totalElements пробовал вот эту команду, не работает:
pm.environment.set("value_test", pm.environment.get("totalElements"));
{
"_embedded": {
"users": [
{
"id": 3,
"firstName": "Robert",
"lastName": "Smith",
"email": "workingemail-3@gmail.com",
"dayOfBirth": "1931-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/3"
},
"user": {
"href": "http://localhost:8080/api/users/3"
}
}
},
{
"id": 4,
"firstName": "Mary",
"lastName": "Portman",
"email": "workingemail-4@gmail.com",
"dayOfBirth": "1972-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/4"
},
"user": {
"href": "http://localhost:8080/api/users/4"
}
}
},
{
"id": 5,
"firstName": "Mary",
"lastName": "Erickson",
"email": "workingemail-5@gmail.com",
"dayOfBirth": "2000-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/5"
},
"user": {
"href": "http://localhost:8080/api/users/5"
}
}
},
{
"id": 6,
"firstName": "Mark",
"lastName": "Roach",
"email": "workingemail-6@gmail.com",
"dayOfBirth": "1957-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/6"
},
"user": {
"href": "http://localhost:8080/api/users/6"
}
}
},
{
"id": 7,
"firstName": "John",
"lastName": "Doe",
"email": "workingemail-7@gmail.com",
"dayOfBirth": "1993-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/7"
},
"user": {
"href": "http://localhost:8080/api/users/7"
}
}
},
{
"id": 8,
"firstName": "John",
"lastName": "Li",
"email": "workingemail-8@gmail.com",
"dayOfBirth": "1943-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/8"
},
"user": {
"href": "http://localhost:8080/api/users/8"
}
}
},
{
"id": 9,
"firstName": "Mary",
"lastName": "Erickson",
"email": "workingemail-9@gmail.com",
"dayOfBirth": "1993-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/9"
},
"user": {
"href": "http://localhost:8080/api/users/9"
}
}
},
{
"id": 10,
"firstName": "Robert",
"lastName": "Doe",
"email": "workingemail-10@gmail.com",
"dayOfBirth": "1999-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/10"
},
"user": {
"href": "http://localhost:8080/api/users/10"
}
}
},
{
"id": 11,
"firstName": "Robert",
"lastName": "Li",
"email": "workingemail-11@gmail.com",
"dayOfBirth": "2000-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/11"
},
"user": {
"href": "http://localhost:8080/api/users/11"
}
}
},
{
"id": 12,
"firstName": "Mark",
"lastName": "Portman",
"email": "workingemail-12@gmail.com",
"dayOfBirth": "1988-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/12"
},
"user": {
"href": "http://localhost:8080/api/users/12"
}
}
},
{
"id": 13,
"firstName": "Nataly",
"lastName": "Doe",
"email": "workingemail-13@gmail.com",
"dayOfBirth": "1983-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/13"
},
"user": {
"href": "http://localhost:8080/api/users/13"
}
}
},
{
"id": 14,
"firstName": "Nataly",
"lastName": "Smith",
"email": "workingemail-14@gmail.com",
"dayOfBirth": "1994-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/14"
},
"user": {
"href": "http://localhost:8080/api/users/14"
}
}
},
{
"id": 15,
"firstName": "Robert",
"lastName": "Smith",
"email": "workingemail-15@gmail.com",
"dayOfBirth": "1971-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/15"
},
"user": {
"href": "http://localhost:8080/api/users/15"
}
}
},
{
"id": 16,
"firstName": "John",
"lastName": "Smith",
"email": "workingemail-16@gmail.com",
"dayOfBirth": "1991-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/16"
},
"user": {
"href": "http://localhost:8080/api/users/16"
}
}
},
{
"id": 17,
"firstName": "Mary",
"lastName": "Erickson",
"email": "workingemail-17@gmail.com",
"dayOfBirth": "1996-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/17"
},
"user": {
"href": "http://localhost:8080/api/users/17"
}
}
},
{
"id": 18,
"firstName": "Mark",
"lastName": "Li",
"email": "workingemail-18@gmail.com",
"dayOfBirth": "1961-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/18"
},
"user": {
"href": "http://localhost:8080/api/users/18"
}
}
},
{
"id": 19,
"firstName": "Alex",
"lastName": "Smith",
"email": "workingemail-19@gmail.com",
"dayOfBirth": "1996-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/19"
},
"user": {
"href": "http://localhost:8080/api/users/19"
}
}
},
{
"id": 20,
"firstName": "Alex",
"lastName": "Smith",
"email": "workingemail-20@gmail.com",
"dayOfBirth": "1934-07-19",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/20"
},
"user": {
"href": "http://localhost:8080/api/users/20"
}
}
},
{
"id": 21,
"firstName": "Fsdkfjn",
"lastName": "Fldfjs",
"email": "sks@ksdnf.ru",
"dayOfBirth": "2004-05-23",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/21"
},
"user": {
"href": "http://localhost:8080/api/users/21"
}
}
},
{
"id": 24,
"firstName": "ksfsldkjf",
"lastName": "lsknfslk",
"email": "slfk@skljf.ru",
"dayOfBirth": "2000-05-20",
"_links": {
"self": {
"href": "http://localhost:8080/api/users/24"
},
"user": {
"href": "http://localhost:8080/api/users/24"
}
}
}
]
},
"_links": {
"first": {
"href": "http://localhost:8080/api/users/?page=0&size=20"
},
"self": {
"href": "http://localhost:8080/api/users/"
},
"next": {
"href": "http://localhost:8080/api/users/?page=1&size=20"
},
"last": {
"href": "http://localhost:8080/api/users/?page=1&size=20"
},
"profile": {
"href": "http://localhost:8080/api/profile/users"
}
},
"page": {
"size": 20,
"totalElements": 22,
"totalPages": 2,
"number": 0
}
}