Hi
Not related in any way to the Avalara API interface but may help (or not...)
This is how I request the french postal service API to get all the cities/towns for a given postal code
The service uses a REST API with JSON data payloads - which is a breeze to generate and parse with PxPlus
0170 REQUEST$=FN_URL$+"/lines"
0180 REQUEST$+="?q="+STR(CCP:"00000")
0190 REQUEST$+="&select="+CVS("nom_de_la_commune,ligne_5","ascii:url")
0200 REQUEST$+="&size=99"
0210 CALL "*plus/web/request",ERR=*NEXT,REQUEST$,"",RESPONSE$,HEADERS$
0220 IF POS("200"=HEADERS$)=0 THEN ERRMSG$=TBL(TCB(2),"",MSG(ERR)); GOSUB USE_LOCAL
0230 DIM LOAD RESULT${ALL}=RESPONSE$,ERR=PROCESS_END
0240 BUREAUX$=""
0250 CITIES=TRY(NUM(RESULT$["total"]),0),CITY=0
0260 WHILE ++CITY<=CITIES
0270 COMMUNE$="",LIGNE_5$=""
0280 COMMUNE$=RESULT$["results."+STR(CITY)+".nom_de_la_commune"]
0290 LIGNE_5$=RESULT$["results."+STR(CITY)+".ligne_5"]
0300 CHOIX$=COMMUNE$
0310 IF POS(";"+CHOIX$+";"=";"+BUREAUX$)=0 THEN BUREAUX$+=CHOIX$+";"
0320 INFO$=PAD(COMMUNE$,INT(MXC(0)/3)); IF LIGNE_5$<>"" THEN INFO$+=PAD(" ancien nom : "+LIGNE_5$,INT(MXC(0)/3)); INFO$
0320:+=PAD(" --> "+CHOIX$,INT(MXC(0)/3))
0330 IF NOT(CALLED) THEN PRINT PAD(INFO$,MXC(0))
0340 WEND
...
0990 DEF FN_URL$="https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal"
The request is built on statements 170-200
The request is sent using the PxPlus HTTP client on statement 210, getting back the response data and HTTP headers
Statement 210 checks the response status (should be 200 if everything went well)
Statement 230 parses the JSON response into a PxPlus associative array
The response JSON schema is :
{
"total": 2
"results": [
{ "nom_de_la_commune": "BRUNOY", "ligne5": "" },
{ "nom_de_la_commune": "BOUSSY SAINT ANTOINE", "ligne5": "" }
]
}
Which results in the following assoc array :
result$["total"]="2"
result$["results.1.nom_de_la_commune"]="BRUNOY"
result$["results.1.ligne5"]=""
result$["results.2.nom_de_la_commune"]="BOUSSY SAINT ANTOINE"
result$["results.2.ligne5"]=""
Making it very easy to iterate and get the required info
Hope this helps