I saved the following country code in environment variables and now I need to take each one from the country code and put it in the URL. The reason is that I need to call the same URL for 200 countries and I was able to retrieve all country codes and save them in environment variables. I do not know how to split the country code with commas and how to apply the parameters to the URL
Environment variable screenshot:
Country codes saved as array in the environment variable AA,UZ,UY,GH,TV,GG,TT,GL,TZ,GI,TW,GN,UG,GM,UA,US,UM,FO,TJ,FM,TH,GA,TL,FR,TK,GD,TN,GB,TM,GF,TR,GE,TO,TF,TD,TG,FK,SS,FJ,SR,SV,ST,SY,SX,TC,SZ,EE,SI,EC,SH,EH,SK,EG,SJ,ES,SM,ER,SL,FI,SO,ET,SN,SG,DM,RU,DK,RS,DZ,SA,DO,RW,SC,SB,SE,SD,CV,PS,CU,PR,CX,PW,CW,PT,CZ,QA,CY,PY,DJ,RO,DE,RE,PM,PL,PN,CR,OM,CO,NZ,PE,PA,PG,PF,PK,PH,CG,NG
Need to apply each country code end of this URL like US
Using the below code I set to environment -
pm.test(“Get code of each countries”, function () {
var jsonData = pm.response.json();
pm.environment.set(“variable_key”, jsonData.map((value) => value.code));
});
Can you please help me how to split the country and how to apply in the params?