CURL or Postman requests as Mobile Clients: Android Phone, Tablet, iPad, iOS

How to simulate mobile client requests via CURL or Postman.

To simulate different device requests towards a server using CURL or Postman, simply modify the User-Agent property in your HTTP request according to the desired device.

Android Phone

For Android, here's an example using a Pixel 4 device:

curl -H "User-Agent: Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36" <your_url>

iPhone

For an iPhone simulation, use iOS Safari as your User-Agent:

curl -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1" <your_url>

iPad:

To mimic an iPad, modify the User-Agent to iPad:

curl -H "User-Agent: Mozilla/5.0 (iPad; CPU OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1" <your_url>

For a list of valid user agents refer to this link.

Subscribe to The Daily Coder

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe