Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Postman - Take the last id from response of a Get request and assign it to variable

I have to make a request to an endpoint with a non-existing id. The endpoint with all users returns a user list with the following structure:

{
    "page": 1,
    "per_page": 10,
    "total": 100,
    "total_pages": 1000,
    "data": [
        {
            "id": 1,
            "email": "a@b",
            "first_name": "a",
            "last_name": "b",
            "avatar": "jpg"
        }
    ]
}

I have to find the last returned id, increment it +1 and assign it to a variable.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use the Lodash last method within the sandbox, to get the id of the last object in the data array.

pm.globals.set('id', _.last(pm.response.json().data).id);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda