GET
/api/cities/:pincode
Retrive a City belongs to Pincode
This endpoint allows you to retrive the data belongs to the Pincode respective pincode.
Required Parameter
-
pincode
- string
-
Postal code or Zipcode of the city.
Request
GET
/api/cities/:pincode
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => '/cities/:pincode',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => ['X-API-KEY' => 'your-api-key'],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return "cURL Error #:" . $err;
} else {
$data = json_decode($response);
}
const axios = require("axios");
const options = {
method: 'GET',
url: '/cities/:pincode',
headers: {
'X-API-KEY': 'your-api-key'
},
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("/cities/:pincode"),
Headers =
{
{ "X-API-KEY", "your-api-key" }
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("/cities/:pincode")
.addHeader("X-API-KEY", "your-api-key")
.build();
Response response = client.newCall(request).execute();