Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!