HTTPS GET Request to import.io API - Server is not returning anything

So. To make it short, i have following REST API URL from import.io (example):

https://api.import.io/store/data/45a41a18-7c02-4b95-bcce-9506cabc2459/_query?input/webpage/url=http%3A%2F%2Fwww.ikea.com%2Fus%2Fen%2Fsearch%2F%3Fquery%3Dchair&_user=315f6e84-8fd6-449f-ae60-6eccfb9a017e&_apikey=7C2or4Abyj9Hhk%2BzDPQtDcwby5szRxJksOQk2qy%2FrJkvA1F7C82JG2WcDII3ofwuip3BK16Y8JLShCxwHgcErQ%3D%3D

pasting this into my browser returns something.

Now i want that something on my arduino. So i thoght i'd just make a regular GET Request.

Problem is, i don't get anything back from the server. I tried Port 80 and 443 (http and https) and all possible ways of spelling the GET request out (With https://..., without, etc.). I'm not even getting a 400 back, i just get back nothing.

So, what am I probably doing wrong? Anyone out there able to get this to work or point me in the right direction? Can't be that hard, can it?

Here is my code

/*
 *  This sketch sends data via HTTP GET requests to data.sparkfun.com service.
 *
 *  You need to get GUID and privateKey at data.sparkfun.com and paste them
 *  below. Or just customize this script to talk to other HTTP servers.
 *
 */

#include <ESP8266WiFi.h>

const char* ssid     = "------";
const char* password = "----";

const char* host = "api.import.io";
const char* import_url = "https://api.import.io/store/data/45a41a18-7c02-4b95-bcce-9506cabc2459/_query?input/webpage/url=http%3A%2F%2Fwww.ikea.com%2Fus%2Fen%2Fsearch%2F%3Fquery%3Dchair&_user=315f6e84-8fd6-449f-ae60-6eccfb9a017e&_apikey=7C2or4Abyj9Hhk%2BzDPQtDcwby5szRxJksOQk2qy%2FrJkvA1F7C82JG2WcDII3ofwuip3BK16Y8JLShCxwHgcErQ%3D%3D";


void setup() {
  Serial.begin(115200);
  delay(10);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
  delay(5000);
  ++value;

  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 443;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  // We now create a URI for the request
  String url = import_url;
  
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  Serial.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");

 
  delay(10);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
}

Some information before you ask: I'm running on an ESP8266 thats why i have a different wifi library. but this has nothing to do with the architecture as I can do GET request to the data.sparkfun.com server and receive data from them (either 200 or 400 if i did something wrong)

 *  This sketch sends data via HTTP GET requests

But NOT https...

Thank you PaulS, this helped me make the code i posted work. Strangely enough the api url i'm actually trying to use still doesn't work, even thought, if you open it in the browser it works like the Ikea example url. How is that possible?

/*
 *  This sketch sends data via HTTP GET requests to data.sparkfun.com service.
 *
 *  You need to get GUID and privateKey at data.sparkfun.com and paste them
 *  below. Or just customize this script to talk to other HTTP servers.
 *
 */

#include <ESP8266WiFi.h>

const char* ssid     = "------";
const char* password = "-----";

const char* host = "api.import.io";
//this one works
const char* import_url = "/store/data/45a41a18-7c02-4b95-bcce-9506cabc2459/_query?input/webpage/url=http%3A%2F%2Fwww.ikea.com%2Fus%2Fen%2Fsearch%2F%3Fquery%3Dchair&_user=315f6e84-8fd6-449f-ae60-6eccfb9a017e&_apikey=7C2or4Abyj9Hhk%2BzDPQtDcwby5szRxJksOQk2qy%2FrJkvA1F7C82JG2WcDII3ofwuip3BK16Y8JLShCxwHgcErQ%3D%3D";
//this one doesn't
//const char* import_url = "/store/connector/81f578f7-8b05-4e80-87ed-80b30fd85bf5/_query?input/webpage/url=http%3A%2F%2Fwww.codecheck.info%2Fessen%2Fmuesli_ceralien%2Fbircher_fruchtmuesli%2Fean_4316268338783%2Fid_796815%2FHaferflocken_zart.pro&_user=fedcd5b6-caee-49f7-959b-7aba844ef508&_apikey=fedcd5b6caee49f7959b7aba844ef508aa7b51fc50b7893e8152be82609f327cc718fcf7b2590262939d941e85ac330b9fff800d7bff5902c07c90b6b40396258dce93e6446635880de387bbb334071d";

void setup() {
  Serial.begin(115200);
  delay(10);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
  delay(5000);
  ++value;

  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  // We now create a URI for the request
  String url = import_url;
  
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  /*Serial.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
               */

 
  delay(10);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
}
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +

There is absolutely NO excuse for wrapping a string in a String, just so you can use one client.print() statement instead of three.

Pissing away resources wrapping a string (import_url) in a String (url) makes no sense, either.

Strangely enough the api url i'm actually trying to use still doesn't work, even thought, if you open it in the browser it works like the Ikea example url. How is that possible?

In the address bar of the browser, you do NOT type a GET request. You type a URL that is parsed into protocol (http:// or https://), a host and a script with zero or more name=value pairs. What your code does can not be compared to what you type in the address bar of the browser, because you did not define what you type in the address bar of the browser.

If what you type starts with https, as you suggested earlier, that would explain why the Arduino can't.

This is a modified example sketch, why should i clean up something before i get it to run properly?

Even though this is not the reason I made this post and this is not helping me solve my problem I'm still interested why 3 client.print() statements are better then the one statement in the sketch?

I'm still interested why 3 client.print() statements are better then the one statement in the sketch?

It may not be better. From my understanding, each print statement results in the formation of a tcp/ip packet. Three prints will result in three packets instead of just one large packet.

This is a modified example sketch, why should i clean up something before i get it to run properly?

Because you started with crap.

I'm still interested why 3 client.print() statements are better then the one statement in the sketch?

Because they use less SRAM. While each print can result in a packet, that may not be a big deal overall. Pissing away memory uselessly is.

Answering all the questions asked IS going to be necessary to resolve your problem, if it can be resolved at all.