-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurl.sh
More file actions
executable file
·21 lines (17 loc) · 1015 Bytes
/
Copy pathcurl.sh
File metadata and controls
executable file
·21 lines (17 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh
# Predio — the three lookup inputs. Free API key (250 calls/month): https://prediohq.com
# Usage: export PREDIO_API_KEY="pk_..." && ./curl.sh
set -eu
: "${PREDIO_API_KEY:?Set PREDIO_API_KEY (get a free key at https://prediohq.com)}"
BASE="https://api.prediohq.com/v1"
echo "== 1) By cadastral reference (14 chars = parcel, 20 = specific property)"
curl -s "$BASE/inmueble/9872023VH5797S0001WX" -H "x-api-key: $PREDIO_API_KEY" | head -c 600; echo; echo
echo "== 2) By coordinates (WGS84 lat/lon — e.g. a map pin)"
curl -s "$BASE/inmueble/by-coords?lat=40.4168&lon=-3.7038" -H "x-api-key: $PREDIO_API_KEY" | head -c 600; echo; echo
echo "== 3) By address (province/municipality by NAME, as the cadastre requires)"
curl -s -G "$BASE/inmueble/by-address" \
--data-urlencode "province=CIUDAD REAL" \
--data-urlencode "municipality=SANTA CRUZ DE MUDELA" \
--data-urlencode "streetName=GLORIA" \
--data-urlencode "streetNumber=51" \
-H "x-api-key: $PREDIO_API_KEY" | head -c 600; echo