Fail to Manipulate External API Data
Options
![Danilo Toledo](https://us.v-cdn.net/6037124/user_avatars/1646760.jpg)
Danilo Toledo
Member ✭
I'm trying to manipulate some data from an external API. Here's an excerpt of the JSON input:
{
"query": {
"email": "xxx",
"queryType": "EmailIPRisk",
"count": 1,
"created": "2021-08-11T17:39:59Z",
"lang": "en-US",
"responseCount": 1,
"billaddress": "xxx",
"billcity": "xxxx",
"billcountry": "xx",
"billpostal": "xxx",
"billregion": "xx",
"firstname": "xx",
"lastname": "xx",
"phone": "xx",
"shipaddress": "xxx",
"shipcity": "xx",
"shipcountry": "xx",
"shippostal": "xx",
"shipregion": "xx",
"transamount": "100.3",
"transcurrency": "xx",
"results": [
{
"userdefinedrecordid": "",
"email": "xx@gmail.com",
"ipaddress": "xxx",
"eName": "xx",
"emailAge": "",
"email_creation_days": "",
"domainAge": "xxx",
"domain_creation_days": "xx",
"firstVerificationDate": "xx",
"first_seen_days": "3665",
"lastVerificationDate": "xxx",
"status": "xx",
"country": "xx",
"fraudRisk": "011 Very Low",
"EAScore": "11",
"EAReason": "Email Name Match",
"EAStatusID": "2",
"EAReasonID": "1001",
"EAAdviceID": "1001",
"EAAdvice": "Approve",
"EARiskBandID": "1",
"EARiskBand": "Fraud Score 1 to 100",
"source_industry": "xx",
"fraud_type": "",
"lastflaggedon": "xxxx",
"dob": "",
"gender": "",
"location": "xxx",
"smfriends": "xx",
"totalhits": "xx",
"uniquehits": "x",
"imageurl": "xx.png",
"emailExists": "xx",
"domainExists": "xx",
"company": "xx",
"title": "xxx",
"domainname": "gmail.com",
"domaincompany": "Google",
"domaincountryname": "United States",
"domaincategory": "Webmail",
"domaincorporate": "No",
"domainrisklevel": "Moderate",
"domainrelevantinfo": "Valid Webmail Domain from United States",
"domainrisklevelID": "3",
"domainrelevantinfoID": "508",
"domaincountrymatch": "No",
"domainriskcountry": "No",
"ip_risklevel": "Moderate",
"ip_riskreasonid": "311",
"ip_riskreason": "Moderate By Proxy Reputation And Country Code",
"ip_reputation": "Good",
"ip_risklevelid": "3",
"ip_anonymousdetected": "False",
"ip_proxytype": "",
"ip_proxydescription": "",
"ip_isp": "xxx",
"ip_org": "xx",
"ip_userType": "xx",
"ip_netSpeedCell": "broadband",
"ip_corporateProxy": "False",
"ip_continentCode": "sa",
"ip_country": "xx",
"ip_countryCode": "xx",
"ip_region": "xx",
"ip_city": "xxx",
"ip_callingcode": "",
"ip_metroCode": "xx",
"ip_latitude": "x",
"ip_longitude": "x",
"ip_map": "x",
"ipcountrymatch": "Yes",
"ipriskcountry": "",
"ipdistancekm": "",
"ipdistancemil": "",
"iptimezone": "x",
"ipasnum": "x",
"ipdomain": "x",
"ip_countryconf": "99",
"ip_regionconf": "90",
"ip_cityconf": "80",
"ip_postalcode": "xx",
"ip_postalconf": "35",
"custphoneInbillingloc": "",
"citypostalmatch": "",
"shipcitypostalmatch": "",
"phone_status": "Valid",
"shipforward": "No",
"billriskcountry": "No",
"namematch": "Y",
"overallDigitalIdentityScore": "74",
"emailToIpConfidence": "62",
"emailToPhoneConfidence": "99",
"emailToBillAddressConfidence": "56",
"emailToShipAddressConfidence": "34",
"emailToFullNameConfidence": "95",
"emailToLastNameConfidence": "95",
"ipToPhoneConfidence": "58",
"ipToBillAddressConfidence": "44",
"ipToShipAddressConfidence": "37",
"ipToFullNameConfidence": "58",
"ipToLastNameConfidence": "58",
"phoneToBillAddressConfidence": "50",
"phoneToShipAddressConfidence": "44",
"phoneToFullNameConfidence": "89",
"phoneToLastNameConfidence": "89",
"billAddressToFullNameConfidence": "44",
"billAddressToLastNameConfidence": "61",
"shipAddressToBillAddressConfidence": "46",
"shipAddressToFullNameConfidence": "30",
"shipAddressToLastNameConfidence": "30",
"disDescription": "High Confidence"
}
]
},
"responseStatus": {
"status": "success",
"errorCode": "0",
"description": ""
}
}
As soon I reach the child "result" (line 24) I'm not able to retrieve it nor any of its childs.
Any ideas or workarounds here?
{
"query": {
"email": "xxx",
"queryType": "EmailIPRisk",
"count": 1,
"created": "2021-08-11T17:39:59Z",
"lang": "en-US",
"responseCount": 1,
"billaddress": "xxx",
"billcity": "xxxx",
"billcountry": "xx",
"billpostal": "xxx",
"billregion": "xx",
"firstname": "xx",
"lastname": "xx",
"phone": "xx",
"shipaddress": "xxx",
"shipcity": "xx",
"shipcountry": "xx",
"shippostal": "xx",
"shipregion": "xx",
"transamount": "100.3",
"transcurrency": "xx",
"results": [
{
"userdefinedrecordid": "",
"email": "xx@gmail.com",
"ipaddress": "xxx",
"eName": "xx",
"emailAge": "",
"email_creation_days": "",
"domainAge": "xxx",
"domain_creation_days": "xx",
"firstVerificationDate": "xx",
"first_seen_days": "3665",
"lastVerificationDate": "xxx",
"status": "xx",
"country": "xx",
"fraudRisk": "011 Very Low",
"EAScore": "11",
"EAReason": "Email Name Match",
"EAStatusID": "2",
"EAReasonID": "1001",
"EAAdviceID": "1001",
"EAAdvice": "Approve",
"EARiskBandID": "1",
"EARiskBand": "Fraud Score 1 to 100",
"source_industry": "xx",
"fraud_type": "",
"lastflaggedon": "xxxx",
"dob": "",
"gender": "",
"location": "xxx",
"smfriends": "xx",
"totalhits": "xx",
"uniquehits": "x",
"imageurl": "xx.png",
"emailExists": "xx",
"domainExists": "xx",
"company": "xx",
"title": "xxx",
"domainname": "gmail.com",
"domaincompany": "Google",
"domaincountryname": "United States",
"domaincategory": "Webmail",
"domaincorporate": "No",
"domainrisklevel": "Moderate",
"domainrelevantinfo": "Valid Webmail Domain from United States",
"domainrisklevelID": "3",
"domainrelevantinfoID": "508",
"domaincountrymatch": "No",
"domainriskcountry": "No",
"ip_risklevel": "Moderate",
"ip_riskreasonid": "311",
"ip_riskreason": "Moderate By Proxy Reputation And Country Code",
"ip_reputation": "Good",
"ip_risklevelid": "3",
"ip_anonymousdetected": "False",
"ip_proxytype": "",
"ip_proxydescription": "",
"ip_isp": "xxx",
"ip_org": "xx",
"ip_userType": "xx",
"ip_netSpeedCell": "broadband",
"ip_corporateProxy": "False",
"ip_continentCode": "sa",
"ip_country": "xx",
"ip_countryCode": "xx",
"ip_region": "xx",
"ip_city": "xxx",
"ip_callingcode": "",
"ip_metroCode": "xx",
"ip_latitude": "x",
"ip_longitude": "x",
"ip_map": "x",
"ipcountrymatch": "Yes",
"ipriskcountry": "",
"ipdistancekm": "",
"ipdistancemil": "",
"iptimezone": "x",
"ipasnum": "x",
"ipdomain": "x",
"ip_countryconf": "99",
"ip_regionconf": "90",
"ip_cityconf": "80",
"ip_postalcode": "xx",
"ip_postalconf": "35",
"custphoneInbillingloc": "",
"citypostalmatch": "",
"shipcitypostalmatch": "",
"phone_status": "Valid",
"shipforward": "No",
"billriskcountry": "No",
"namematch": "Y",
"overallDigitalIdentityScore": "74",
"emailToIpConfidence": "62",
"emailToPhoneConfidence": "99",
"emailToBillAddressConfidence": "56",
"emailToShipAddressConfidence": "34",
"emailToFullNameConfidence": "95",
"emailToLastNameConfidence": "95",
"ipToPhoneConfidence": "58",
"ipToBillAddressConfidence": "44",
"ipToShipAddressConfidence": "37",
"ipToFullNameConfidence": "58",
"ipToLastNameConfidence": "58",
"phoneToBillAddressConfidence": "50",
"phoneToShipAddressConfidence": "44",
"phoneToFullNameConfidence": "89",
"phoneToLastNameConfidence": "89",
"billAddressToFullNameConfidence": "44",
"billAddressToLastNameConfidence": "61",
"shipAddressToBillAddressConfidence": "46",
"shipAddressToFullNameConfidence": "30",
"shipAddressToLastNameConfidence": "30",
"disDescription": "High Confidence"
}
]
},
"responseStatus": {
"status": "success",
"errorCode": "0",
"description": ""
}
}
As soon I reach the child "result" (line 24) I'm not able to retrieve it nor any of its childs.
Any ideas or workarounds here?
Comments
-
- can you provide some insights and screen shots perhaps of what you've tried so far but is not working?
-
So the issue appears to be the API is not sending your payload in proper JSON format. Your external API is sending the response as Content-type: application/x-www-form-urlencode
https://mrkr.io/s/61143cfa5b47aa37819a6374/0
You will want a Content-type: application/json
Perhaps they have a REST API that outputs JSON to work with? -
Thank you for your answer . But I'm not sure that it's the problem.
The request that i send to the API is in the format application/x-www-form-urlencode but i'm pretty sure that its response is actually in JSON format (as pasted bellow).
{
"query": {
"email": "test@gmail.com",
"ip": "12.12.12.12",
"queryType": "EmailIPRisk",
"count": 1,
"created": "2018-06-09T00:09:48Z",
"lang": "en-US",
"responseCount": 1,
"acceptlang": "en-US",
"billaddress": "billing address",
"billcity": "billing city",
"billcountry": "US",
"billpostal": "85000",
"billregion": "AZ",
"deviceid": "deviceid",
"devicesource": "100",
"existingcustomer": "true",
"firstname": "Test",
"lastname": "EA",
"phone": "+11234567890",
"response_language": "en-US",
"shipaddress": "shipping address",
"shipcity": "shipping city",
"shipcountry": "US",
"shippostal": "85001",
"shipregion": "AZ",
"transamount": "10",
"transcurrency": "USD",
"transorigin": "IN",
"customerid": "C111111",
"useragent": "User agent",
"time_to_service": "100",
"secondary_email": "test2@emailage.com",
"service_date": "2018-1-1",
"service_location": "service location",
"service_detail": "service detail",
"service_category": "service category",
"delivery_type": "delivery type",
"cardFirstSix": "542418",
"trackingid": "12345",
"transactionTypeId": "1",
"transactionTypeDescription": "Account creation",
"custom1": "one",
"custom2": "two",
"custom3": "three",
"custom4": "four",
"custom5": "five",
"custom6": "six",
"custom7": "seven",
"results": [
{
"userdefinedrecordid": "urid",
"email": "test@gmail.com",
"ipaddress": "12.12.12.12",
"eName": "Test EA",
"emailAge": "",
"email_creation_days": "",
"domainAge": "1995-08-13T04:00:00Z",
"domain_creation_days": "8335",
"firstVerificationDate": "2005-05-30T00:00:00Z",
"first_seen_days": "4758",
"lastVerificationDate": "2018-06-08T08:15:49Z",
"status": "EmailInexistent",
"country": "US",
"fraudRisk": "995 Very High",
"EAScore": "995",
"EAReason": "Fraud Level 6",
"EAStatusID": "3",
"EAReasonID": "1",
"EAAdviceID": "1",
"EAAdvice": "Fraud Review",
"EARiskBandID": "6",
"EARiskBand": "Fraud Score 900 to 999",
"source_industry": "Anti-Fraud Solution Provider",
"fraud_type": "Customer Dispute (Chargeback)",
"lastflaggedon": "2018-05-29T17:29:00Z",
"dob": "",
"gender": "",
"location": "",
"smfriends": "2",
"totalhits": "510",
"uniquehits": "3",
"imageurl": "",
"emailExists": "Not Anymore",
"domainExists": "Yes",
"company": "",
"title": "",
"domainname": "gmail.com",
"domaincompany": "Google",
"domaincountryname": "United States",
"domaincategory": "Webmail",
"domaincorporate": "No",
"domainrisklevel": "Moderate",
"domainrelevantinfo": "Valid Webmail Domain from United States",
"domainrisklevelID": "3",
"domainrelevantinfoID": "508",
"domaincountrymatch": "Yes",
"domainriskcountry": "No",
"smlinks": [{
"source": "GooglePlus",
"link": "https://plus.google.com/10886018"
}
],
"ip_risklevelid": "3",
"ip_risklevel": "Moderate",
"ip_riskreasonid": "311",
"ip_riskreason": "Moderate By Proxy Reputation And Country Code",
"ip_reputation": "Good",
"ip_anonymousdetected": "No",
"ip_proxytype": "",
"ip_proxydescription": "",
"ip_isp": "att services inc.",
"ip_org": "alascom inc.",
"ip_userType": "wifi",
"ip_netSpeedCell": "broadband",
"ip_corporateProxy": "Yes",
"ip_continentCode": "na",
"ip_country": "United States",
"ip_countryCode": "US",
"ip_region": "alaska",
"ip_city": "fairbanks",
"ip_callingcode": "907",
"ip_metroCode": "745",
"ip_latitude": "64.8363",
"ip_longitude": "-147.715",
"ip_map": "https://app.emailage.com/query/GoogleMaps?latLng=64.8363,-147.715&radius=&title=fairbanks,alaska,United+States",
"ipcountrymatch": "Yes",
"ipshipcountrymatch": "Yes",
"ipriskcountry": "",
"ipdistancekm": "8637",
"ipdistancemil": "5366",
"ipshipdistancekm": "1401",
"ipshipdistancemil": "870",
"ipaccuracyradius": "",
"iptimezone": "-800",
"ipasnum": "32328 alascom inc.",
"ipdomain": "att.com",
"ip_countryconf": "99",
"ip_regionconf": "99",
"ip_cityconf": "95",
"ip_postalcode": "99701",
"ip_postalconf": "50",
"ip_riskscore": "",
"custphoneInbillingloc": "Not Found",
"citypostalmatch": "",
"shipcitypostalmatch": "No",
"phone_status": "Invalid",
"shipforward": "",
"billriskcountry": "No",
"namematch": "Y",
"deviceIdRiskLevel": "Moderate",
"phoneowner": "Test EA",
"phoneownertype": "CONSUMER",
"phonecarriertype": "mobile",
"phonecarriernetworkcode": "012",
"phonecarriername": "Verizon Wireless",
"phoneownermatch": "Y",
"issuerBank": "CITIBANK N.A.",
"issuerBrand": "MASTERCARD",
"issuerCountry": "US",
"cardCategory": "PLATINUM",
"cardType": "CREDIT",
"correlationId": "6740fcb0-677c-468e-a551-f3950cc26b06",
"transAmount": "10",
"transCurrency": "USD",
"trackingId": "12345",
"custom1": "one",
"custom2": "two",
"custom3": "three",
"custom4": "four",
"custom5": "five",
"custom6": "six",
"custom7": "seven"
}
]
},
"responseStatus": {
"status": "success",
"errorCode": "0",
"description": ""
}
}
So much that Xano interface is able to identify its response fields when I configure which values should be stored on a new variable:
[image.png]
But somehow it doesn't work when I Run & Debug.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback