Getting return code -1 when sending httprequest, but it works with postman

I'm trying to send some data from a ESP8266to my API and database. The same exact Json formatted data and url works perfectly when sending from Postman. But for some reason it doesn't work from my ESP8266.

I'm at a loss as to how I can figure this one out :confused:

Any and all help is greatly appreciated!

Below is the kind for the sending of data:

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>

int sense_Pin = 0; // sensor input at Analog pin A0

int value = 0;
int WET = 16; // Wet Indicator at Digital pin D0

int DRY = 2; // Dry Indicator at Digital pin D4
void setup()
{
    Serial.begin(115200);
    pinMode(WET, OUTPUT);
    pinMode(DRY, OUTPUT);
    delay(2000);

    WiFi.begin("SSID",
               "PASS");

    while (WiFi.status() != WL_CONNECTED)
    { //Wait for the WiFI connection completion

        delay(500);
        Serial.println("Waiting for connection");
    }
}

void loop()
{

    //Serial.print("MOISTURE LEVEL : ");
    value = analogRead(sense_Pin);
    value = value;

    if (WiFi.status() == WL_CONNECTED)
    { //Check WiFi connection status
        StaticJsonBuffer<300> JSONbuffer; //Declaring static JSON buffer
        JsonObject &JSONencoder = JSONbuffer.createObject();

        JSONencoder["PlantId"] = "3";

        JSONencoder["SoilMoistureLevel"] = value;
        

        char JSONmessageBuffer[300];
        JSONencoder.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
        Serial.println(JSONmessageBuffer);

        HTTPClient http; //Declare object of class HTTPClient

        http.begin("MyApi.net"); //Specify request destination
        http.addHeader("Content-Type", "application/json");      //Specify content-type header

        int httpCode = http.POST(JSONmessageBuffer); //Send the request
        String payload = http.getString();           //Get the response payload

        Serial.println(httpCode); //Print HTTP return code
        Serial.println(payload);  //Print request response payload

        http.end(); //Close connection
    }
    else
    {

        Serial.println("Error in WiFi connection");
    }

    delay(30000); //Send a request every 30 seconds
}