Adding a hostname to a javascript app using PHP curl

Hello! I am unable to add a hostname to the javascript app we have registered using PHP curl.

This code has been working up until recently, is there something I am doing wrong?

Thank you in advance

        $flyiotoken = "{our-fly-token}";

        $edgeapp = "{our-app-name}/hostnames";

        $route_data = [
            "data" => [
                "attributes" => [
                    "hostname" => ''

        $headers = array(
            'Content-type: application/json',
            'Authorization: Bearer ' . $flyiotoken,

        $route_ch = curl_init();
        curl_setopt($route_ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($route_ch, CURLOPT_URL, $edgeapp);
        curl_setopt($route_ch, CURLOPT_POST, 1);
        curl_setopt($route_ch, CURLOPT_POSTFIELDS, json_encode($route_data));
        curl_setopt($route_ch, CURLOPT_RETURNTRANSFER, 1);

This is an old API URL! Try changing it to:{our-app-name}/hostnames

This likely worked up until we replaced our frontend proxy a few weeks ago. The endpoint is stable. :slight_smile:

1 Like

Thanks Kurt!