開發測試資料-通過API批量生成
阿新 • • 發佈:2021-09-05
參考網址
背景
在日常開發過程中,可能需要一些批量的使用者資料,方便開發與測試。
Random User是一個基於Web 的api服務
從網址上就能理解,它是用來幫我們生成使用者資訊的。
簡單使用
呼叫api
url:https://randomuser.me/api/
在瀏覽器上輸入url,並開啟
1 { 2 "results": [ 3 { 4 "gender": "male", 5 "name": { 6 "title": "Mr", 7 "first": "EgeView Code", 8 "last": "Özkara" 9 }, 10 "location": { 11 "street": { 12 "number": 9698, 13 "name": "Abanoz Sk" 14 }, 15 "city": "Karaman", 16 "state": "Samsun", 17 "country": "Turkey", 18 "postcode": 35154, 19 "coordinates": { 20 "latitude": "79.1797", 21 "longitude": "-67.2571" 22 }, 23 "timezone": { 24 "offset": "-2:00", 25 "description": "Mid-Atlantic" 26 } 27 }, 28 "email": "[email protected]", 29 "login": { 30 "uuid": "5f5f6da4-1a66-45aa-89ba-c6e84a0bb763", 31 "username": "redostrich788", 32 "password": "maxmax", 33 "salt": "hMxAuNOV", 34 "md5": "e2455e698308cfd4765a984bd25c36fc", 35 "sha1": "4aeb8cfda7ec02b4f6b1cd35d9dae5063336bbc4", 36 "sha256": "626106c5abf144218c28006c6992f2fdf3c269b64183751735c734fb425843a8" 37 }, 38 "dob": { 39 "date": "1966-10-13T13:20:45.561Z", 40 "age": 55 41 }, 42 "registered": { 43 "date": "2017-10-08T16:27:30.471Z", 44 "age": 4 45 }, 46 "phone": "(260)-764-4157", 47 "cell": "(314)-856-8614", 48 "id": { 49 "name": "", 50 "value": null 51 }, 52 "picture": { 53 "large": "https://randomuser.me/api/portraits/men/50.jpg", 54 "medium": "https://randomuser.me/api/portraits/med/men/50.jpg", 55 "thumbnail": "https://randomuser.me/api/portraits/thumb/men/50.jpg" 56 }, 57 "nat": "TR" 58 } 59 ], 60 "info": { 61 "seed": "3724764486dcae77", 62 "results": 1, 63 "page": 1, 64 "version": "1.3" 65 } 66 }