I trying to query a value inside a JSON. I have to send a GET request to an API to retrieve that data using params in the url.
How do I retrieve records which has country = France? What should I add in the query part of the URL to retrieve records that belong to the France country?
{
"results": [
{
"gender": "female",
"name": {
"title": "Ms",
"first": "Marsha",
"last": "Jacobs"
},
"location": {
"street": {
"number": 673,
"name": "White Oak Dr"
},
"city": "Saginaw",
"state": "South Dakota",
"country": "United States",
"postcode": 73528,
"coordinates": {
"latitude": "88.6549",
"longitude": "58.0396"
},
"timezone": {
"offset": "-2:00",
"description": "Mid-Atlantic"
}
},
"email": "[email protected]",
"login": {
"uuid": "7e61fccb-aa06-48c9-a112-03f2e9860029",
"username": "bigcat139",
"password": "batman",
"salt": "QOayHXLQ",
"md5": "8ef57655311d2e90092066bc69e054c6",
"sha1": "f094b59680a5e0377db706c0c3bccb4afd7fe055",
"sha256": "9d5d62039ccbb59144b1358c65d8a4114a135a80119400f23f2fce4d93713545"
},
"dob": {
"date": "1957-07-26T05:27:00.832Z",
"age": 64
},
"registered": {
"date": "2019-09-25T12:30:37.247Z",
"age": 2
},
"phone": "(965)-400-1668",
"cell": "(108)-397-9370",
"id": {
"name": "SSN",
"value": "919-74-7855"
},
"picture": {
"large": "https://randomuser.me/api/portraits/women/17.jpg",
"medium": "https://randomuser.me/api/portraits/med/women/17.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/women/17.jpg"
},
"nat": "US"
}
],
"info": {
"seed": "a6df1899c0e0a96b",
"results": 1,
"page": 1,
"version": "1.3"
}
}
Found it after a couple of tries! Used "nat" key-value pair to fetch the the desired record!
GET {{baseURL}}/api?nat="FR"