please help with wix-fetch get

Hi I am trying to use Ziptastic API to autofill the City and State info in the user input form and using the below code. But it’s always going to “Fetch did not succeed”. Please help

// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import {
fetch
} from ‘wix-fetch’;
$w.onReady( function () {
//TODO: write your page related code here…
});
export function input4_keyPress(event) {
//Add your code for this event here:
let zipcode = $w(“#input4”).value;
let apiUrl = “http://ZiptasticAPI.com/”;
if (zipcode.length === 5) {
fetch(apiUrl + zipcode, {
“method”: “get”
})
.then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json();
} else {
return Promise.reject(“Fetch did not succeed”);
}
})
.then((json) => {
console.log(JSON.stringify(json));
$w(“#input5”).value = json.city;
$w(“#input6”).value = json.state;
})
. catch (err => console.log(err));
}
}

Make sure that you follow the Ziptastic API guidelines when doing your code.
https://www.getziptastic.com/documentation
https://ziptasticapi.com/

Also, please make sure that you are using Wix Fetch correctly too.
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api

You can see this Wix Corvid example here about exposing your site.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

@givemeawhisky looks like it was expecting https in api get, works after changing it. Thanks

@dustlesspuma Exactly. For more details, see About SSL and HTTPS .

BTW - SSL/HTTPS can be disabled for a site, but it’s NOT recommended.