Invalid Json Response when accessing third-party service

Hello all,

I am attempting to gather details about real estate properties through an external API. I’ve gone over their documentation relentlessly but can not figure out why I am receiving the following error:

invalid json response body at https://api.gateway.attomdata.com/propertyapi/v1.0.0/property/expandedprofile?address1=34%20Karen%20Court&address2=Bridgeport20%CT reason: Unexpected token < in JSON at position 

For reference, I am posting my code. If anyone can provide any input or guidance I would greatly appreciate it!

Backend Code:

import { fetch } from 'wix-fetch';
import { wixData } from 'wix-data';

export function getDetails(address, citystatezip) {
 const url = 'https://api.gateway.attomdata.com/propertyapi/v1.0.0/property/expandedprofile?address1=' + address + "&address2=" + citystatezip;
 let headers = {
        "apikey": "xxxxxxxx",
        "accept": "application/json"
    };
 let options = {
        headers: headers
    }

    console.log("Url: " + url);

 return fetch(url, { method: 'get' })
        .then(response => {
 return response.json();
        })
        .then((data) => {
            console.log(data);
 return data;
        });
}
  

Page Code:

import { reverse } from 'backend/google';
import { wixData } from 'wix-data';
import wixLocation from "wix-location";
import wixWindow from 'wix-window';
import { encodeString } from 'backend/encode.jsw';
import { getDetails } from 'backend/scrape.jsw';

$w.onReady(function () {

});

wixWindow.getCurrentGeolocation()
    .then((obj) => {
 let timestamp = obj.timestamp; // 1495027186984
 let latitude = obj.coords.latitude; // 32.0971036
 let longitude = obj.coords.longitude; // 34.774391099999995
 let altitude = obj.coords.altitude; // null
 let accuracy = obj.coords.accuracy; // 29
 let altAccuracy = obj.coords.altitudeAccuracy; // null
 let heading = obj.coords.heading; // null
 let speed = obj.coords.speed;
        console.log(obj)

        reverse(latitude, longitude)
            .then(geocode => {
                console.log(geocode)

                $w("#input12").value = geocode.results[0].address_components[0].long_name + " " + geocode.results[0].address_components[1].long_name;
                $w("#input10").value = geocode.results[0].address_components[3].long_name;
                $w("#input11").value = geocode.results[0].address_components[5].long_name;
                $w("#text37").text = geocode.results[0].formatted_address;

                $w("#googleMaps2").location = {
 "latitude": latitude,
 "longitude": longitude,
 "description": geocode.results[0].formatted_address

                };

 let address = geocode.results[0].address_components[0].long_name + " " + geocode.results[0].address_components[1].long_name;
 let citystatezip = geocode.results[0].address_components[3].short_name + "%2C%20" + geocode.results[0].address_components[5].short_name;

 const uri = address;
 const encoded = encodeURI(uri);
                console.log(encoded);

                getDetails(encoded, citystatezip)
                    .then(details => {
                        console.log(details)
                    })

            });
    });

Happy Coding :blush: