Wrong URL ????

Wrong URL ????

hello,

I have built the interface to the "Calendar".

See attachment 1.

The updating of the token when the time has expired is also successfully implemented. (will be automated later in the query)

Only here I have a problem.
https://www.zoho.com/calendar/help/api/get-calendar-list.html

I have attached my PHP code once as a TXT attachment.
As well as its response as an image. Attachment 2:

"Invalid URL

Unable to process your request as the URL /calendar/api/v1/calendars?category=all&showhiddencal=true is invalid."


What am I doing wrong or is the documentation no longer correct?

Many thanks for your help.

  1. <?php

    function fetch_and_renew_token() {
        $client_id = NMT::sqlObject("SELECT `val` FROM `nmt-cfg` WHERE `key` = 'zoho_client_id'; ")->val;
        $client_secret = NMT::sqlObject("SELECT `val` FROM `nmt-cfg` WHERE `key` = 'zoho_client_secret'; ")->val;
        $refresh_token = NMT::sqlObject("SELECT `val` FROM `nmt-cfg` WHERE `key` = 'zoho_refresh_token'; ")->val;

        if (!empty($client_id) && !empty($client_secret) && !empty($refresh_token)) {
            $url = 'https://accounts.zoho.eu/oauth/v2/token';
            $data = [
                'refresh_token' => $refresh_token,
                'client_id' => $client_id,
                'client_secret' => $client_secret,
                'grant_type' => 'refresh_token'
            ];

            $response = custom_curl_request($url, $data);

            if (isset($response['access_token'])) {
                $access_token = $response['access_token'];
                $expires_in = $response['expires_in'];
                $api_domain = $response['api_domain'];
                $expires_at = time() + $expires_in + 7200; // +2 Stunden

                NMT::sqlDo("INSERT INTO `nmt-cfg` (`key`, `val`) VALUES ('zoho_access_token', '$access_token') ON DUPLICATE KEY UPDATE `val` = '$access_token';");
                NMT::sqlDo("INSERT INTO `nmt-cfg` (`key`, `val`) VALUES ('zoho_token_expires_at', '$expires_at') ON DUPLICATE KEY UPDATE `val` = '$expires_at';");
                NMT::sqlDo("INSERT INTO `nmt-cfg` (`key`, `val`) VALUES ('zoho_api_domain', '$api_domain') ON DUPLICATE KEY UPDATE `val` = '$api_domain';");

                return $access_token;
            } else {
                echo '<div style="color: red;">Fehler bei der Token-Erneuerung.</div>';
                echo '<pre>' . print_r($response, true) . '</pre>';
                return null;
            }
        } else {
            echo '<div style="color: red;">Fehler: Client ID, Client Secret oder Refresh Token fehlen.</div>';
            return null;
        }
    }

    function custom_curl_request($url, $data = [], $type = 'POST', $headers = []) {
        $curlOpts = [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS,
            CURLOPT_CUSTOMREQUEST => $type,
            CURLOPT_SSL_VERIFYPEER => FALSE,
        ];

        if ($type === 'POST' && !empty($data)) {
            $curlOpts[CURLOPT_POSTFIELDS] = http_build_query($data);
        }

        if (!empty($headers)) {
            $curlOpts[CURLOPT_HTTPHEADER] = $headers;
        }

        $request = curl_init();
        curl_setopt_array($request, $curlOpts);
        $response = curl_exec($request);
        $curl_error = curl_error($request);
        $http_code = curl_getinfo($request, CURLINFO_HTTP_CODE);
        curl_close($request);

        if ($curl_error) {
            echo '<div style="color: red;">Curl Error: ' . htmlspecialchars($curl_error) . '</div>';
        }

        echo '<div>HTTP Code: ' . htmlspecialchars($http_code) . '</div>';
        echo '<div>Request URL: ' . htmlspecialchars($url) . '</div>';
        echo '<div>Request Headers: ' . htmlspecialchars(print_r($headers, true)) . '</div>';
        
        if ($http_code >= 400 && $http_code < 600) {
            echo '<div>Raw Response: ' . $response . '</div>';
        } else {
            echo '<div>Raw Response: ' . htmlspecialchars($response) . '</div>';
        }

        return json_decode($response, TRUE);
    }

    function fetch_calendars() {
        $access_token = NMT::sqlObject("SELECT `val` FROM `nmt-cfg` WHERE `key` = 'zoho_access_token'; ")->val;
        $api_domain = NMT::sqlObject("SELECT `val` FROM `nmt-cfg` WHERE `key` = 'zoho_api_domain'; ")->val;

        if (!empty($access_token) && !empty($api_domain)) {
            echo '<div>Verwendeter Access Token: ' . htmlspecialchars($access_token) . '</div>';
            echo '<div>Verwendete API Domain: ' . htmlspecialchars($api_domain) . '</div>';

            $url = $api_domain . '/calendar/api/v1/calendars?category=all&showhiddencal=true';
            $headers = [
                "Authorization: Bearer $access_token"
            ];

            $curl_command = "curl -X GET \"$url\" -H \"Authorization: Bearer $access_token\"";
            echo '<div>Curl Command: ' . htmlspecialchars($curl_command) . '</div>';

            $response = custom_curl_request($url, [], 'GET', $headers);

            if (isset($response['calendars'])) {
                echo '<div>Kalender erfolgreich abgerufen:</div>';
                echo '<pre>' . print_r($response['calendars'], true) . '</pre>';
            } else {
                echo '<div style="color: red;">Fehler beim Abrufen der Kalender.</div>';
                echo '<pre>' . print_r($response, true) . '</pre>';
            }
        } else {
            echo '<div style="color: red;">Fehler: Access Token oder API Domain fehlt.</div>';
        }
    }

    if (isset($_POST['fetch_calendars'])) {
        fetch_calendars();
    }

    if (isset($_POST['fetch_token'])) {
        fetch_and_renew_token();
    }
    ?>

    <form method="post" action="">
        <input type="submit" name="fetch_token" value="Fetch-Token" />
        <input type="submit" name="fetch_calendars" value="Kalender abfragen" />
    </form>
    • Topic Participants

    • test

    • Sticky Posts

    • The year that was at Zoho Calendar 2023- Part 1

      Hello, amazing community members! Happy new year from all of us here at Zoho Calendar. As we begin the new year, we'd like to thank each and everyone of our community members for your unwavering support and love that you have shown for Zoho Calendar.
    • What's new in Zoho Calendar!

      Hello all, Greeting from Zoho Calendar! Hope you are all doing well! We at Zoho Calendar are constantly striving to improve our Calendar to enhance your overall calendaring experience thanks to your insightful suggestions and feedback. In the last few
    • Enhancements to make Zoho Calendar more accessible and handy!

      Hello, Community! Hope you're all doing well! Zoho Calendar have come across a major revamp a year back. Since then the feedback and suggestions given by you made us to improve and enhance Calendar, to make it more accessible and user friendly. We've
    • Important announcement: Deprecation of Zoho Calendar's old interface

      Hello All! Thank you all for the amazing welcome to the release of the new Calendar. Here are some comments about the new interface that motivated us:  Many of our users who were using the older version for a long period, loved the new Calendar, as it
    • What's new in the revamped calendar - An overview of user interface and features

      Hello Everyone, Scheduling meetings and events using online calendars has become inevitable as almost the entire business world has gone online. Keeping track of events, meetings and appointments has become a necessity. To serve you better, we at Zoho have
    • Recent Topics

    • TeamInbox down?

      Hi everyone, we are getting message "Sorry, this action cannot be performed due to an internal error. Please try again later. We are on the Canadian data centers. Can someone please confirm if the service is down? Thank you! F
    • Purchase Requisition in Zoho Books

      I want to understand if Zoho Books is having the following workflow: PR ( Purchase Requisition ) >> PO ( Purchase order) >>  GRN/SRN ( Goods/Services receipt note) >> Bill
    • Confirmation prompt before a custom button action is triggered

      Have you ever created a custom button and just hoped that you/your users are prompted first to confirm the action? Well, Zoho knows this concept. For example, in blueprint, whenever we want to advance to the next state by clicking the transition, it is
    • Marketer's Space: Streamline marketing and sales by integrating ZMA's Planner with Zoho CRM

      In a competitive market, clear goal-setting and seamless campaign execution are crucial for marketing and sales alignment. When integrated with Zoho CRM, Zoho Marketing Automation's Planner enables marketers to create, manage, and measure campaigns effectively
    • Custom emails for Portals not working

      I changed the standard templates to custom email templates for all three options, but the invitation is still sending the original email layouts. Anyone know why this would be happening? I changed them 2 days ago.
    • Switching scheduled webinars from Live to On-demand

      Now that On-Demand webinars has been added as an option for webinar presenting, is there a way I can edit already scheduled webinars from Live to on-Demand? These scheduled webinars already have people registered. Thanks
    • Zoho CRM v2.1 deprecation or sunset plans ?

      Hi Team Wanted to know if there is any plan to deprecate v2.1 CRM apis https://www.zoho.com/crm/developer/docs/api/v2.1/ and if yes by when
    • Forex Bank Refund Entry

      Hello, please advise how to enter refunds from our bank forex department. The refund was because we were on preferential rates but at the time of USD purchase were not given the preferential rate, therefore the bank calculated the excess that we paid
    • Auto-Populating Custom Field

      This is to request a feature enhancement for our invoicing system. We're currently creating invoices with a single item per invoice and have a custom field called "Related Vehicle." We would like the "Related Vehicle" field to be automatically populated
    • How can i Customize Delivery Note?

      I need to customize delivery note like change the tittle for language purposes and also include only the balance due
    • Delivery note template

      We have some reasonable templates for sales docs but the delivery note one is very limited. It would be nice if we could have the same options as the sales form templates or even create our own by cloning an existing sales template, modifying (ie: removing
    • INTERCOMPANIES INVOICING

      Dears , I paid expenses on behalf of our sister company from my cash account , then month End i issued an invoice to the sister company , my question is how to put the expenses GL in the invoices
    • Zoho CRM Theme Color?

      I've read multiple articles stating it's possible to change Zoho CRM theme colour (top menu bar) from personal settings menu, however, my zoho has no options for this at all and I've looked everywhere........has this feature been removed? I'm currently
    • How can i force the user to select a project when creating an invoice ?

      Hello I tried all the ways that i know , but no way is able to stop creating an invoice without project.
    • Sales

      1/ How can I make a discount on invoice exmple : invoice 5,100 le , custmar pay 5000 and I need to make this 100 le as a discount , how can i make it ?! 2/ Is thare any report can make me match my company’s balance with the customer’s balance?
    • Include Project Hours when Creating Estimates from Projects

      Hi Currently, in Books, you can create estimates from Projects by inserting tasks that pull both the task and the hourly charge rate. But it doesn't pull the budgeted hours for the task, so you manually have to remember the number of hours for a given
    • acc

      Regularly sending statements to customers is an imperative part of many business processes as it helps foster strong customer relationships and provides timely guidance on pay//
    • South African Payment Gateways

      Since the "Demise" of Wave many South African users have moved over to Zoho and yet for years users have been requesting Integration with a South African Payment Gateway to no avail. Payfast was the most commonly requested gateway as it supports recurring
    • CRM Implementation

      I need to implement Zoho CRM. Is there a useful user manual available to guide me through the implementation?
    • Zoho Social integration with Zoho Flow

      Is there any plans for Zoho Social integration with Zoho Flow?
    • Marketing 2.0 has been a catastrophe

      Anyone else having significant issues with their link between their CRM and Marketing automation since moving to version 2.0? We had an easy flow for triggering leads in the CRM to journeys in Marketing Automation but now nothing seems to work properly.
    • Cannot average "Duration (Time)" from Pick List History Tracking in Reports

      Okay, let's say I have a custom module. In this custom module I have a pick-list named "Status" with "New", "In-Progress", "Completed" values. I also have turned ON pick-list history tracking and chose "Time" to track the duration in (instead of "Calendar
    • Customer Statement Template

      Hi. how can i add order number "customer LPO number" in the customer statement. regards
    • Authorize.Net Update: Disable Transaction IP Velocity Filter to Avoid Payment Failures

      Update: The Authorize.Net integration was updated on November 20, 2024. To prevent recurring transaction failures, we recommend disabling the Transaction IP Velocity Filter at the earliest. We’re updating the Authorize.Net integration in Zoho Books on
    • Need to send a single email to up to 20 recipients

      I want to send a single email to ~16 or 20 recipients. It appears that I cannot do this in Zoho email as it gets flagged as unusual activity. I need to be able to communicate with this group on a regular basis. What am I missing that Zoho doesn't allow
    • Whatsapp Limitation Questions

      Good day, I would like to find out about the functionality or possibility of all the below points within the Zoho/WhatsApp integration. Will WhatsApp buttons ever be possible in the future? Will WhatsApp Re-directs to different users be possible based
    • Unable to Schedule One-to-One Emails in Zoho CRM

      Hi everyone, I’m using the Zoho CRM Professional Edition and facing an issue with scheduling one-to-one emails directly from CRM. While I can send immediate emails without any problem, I don’t see an option to schedule these emails for a later time. I’ve
    • Canvas Detail View Related List Sorting

      Hello, I am having an issue finding a way to sort a related list within a canvas detail view. I have sorted the related list on the page layout associated with the canvas view, but that does not transfer to the canvas view. What am I missing?
    • Repeatable Fields/Sections in Zoho CRM

      Hi Zoho Team, We have a module in CRM named "Clients". We would like to know whether it is possible to have a feature enables us to have repeatable sections in our clients' profiles? For example, if we customized a section in the clients' profiles named
    • Zoho Analytics: Requests for view access

      Hello, We have a user that might request access to a certain view, report etc. However this request for access is being sent to different admins within the workspace, is is possible to set who the "approver" is of these requests? If not what are the rules
    • Boolean Fields in Mail Merge Displaying as Checkmarks

      I'm really liking the new mail merge functionality. It's replaced the Zoho Sign extension for us. One problem I've seen is that boolean operators (i.e. Checkbox fields) in CRM merge as "True" or "False". This looks a little ugly in my final document — is there a way I can get those to display as checkboxes?
    • Formula in Sub Form

      Hello - I have created a sub-form and the data is going to be insurance policy information. However some of the policy amounts are based on a percentage of a main coverage. For example, Debris removal coverage is 5% of the main dwelling policy. Is there
    • Email alias already exist

      Hello, I'm getting an error message the email alias already exist when attempting to add 2 email addresses. The emails are associated with an account I deleted. I started a new account and need to add them back to get 1 email at each. I have an open ticket
    • Migrate emails from a shared mail box to a private mail box

      How is possible migrate a shared mail box if the migration tool require a password, and the shared mail dosent have ?
    • Support poor service

      I just wanted Zoho support to give me some more concrete answers. I’m facing SMTP error issues, and they told me that the South American IP was experiencing problems, but they didn’t provide an estimate for when it would be resolved. Now my company is
    • Zoho say my domain seems to be already associated with another account

      I created a zoho account for try my domain mail configuration. When I want to add my domain in this page https://mailadmin.zoho.com/hosting?plan=free then this shows an error that is "This domain is already associated with this account a*****n@f*****."
    • Incorrect Device Time

      Hi On my windows laptop I can't sign into Zoho mail due to "incorrect device time". I'm in Toronto, Canada. How can this be resolved?
    • Get user images by API

      Hi For our internal management software, I want to retrieve user photos via REST API: curl --location --request GET 'https://profile.zoho.com/file?fs=thumb&ID=<zoid>' \ --header 'Authorization: Zoho-oauthtoken <token>' The token has `profile.userphoto.ALL`,
    • Depois de 1 ano não consigo receber e-mail

      Consigo enviar e-mails mas não estou recebendo nenhum e-mail isso aconteceu pontualmente após eu completar 1 ano de uso. Me ajudem por favor
    • Submitted form URL

      I am using the feature "Include a link to allow respondents to edit their responses" for the first time. This URL is included in the email sent to the user after they press Submit. If a form is Saved, there is a section called Partially Saved Entries
    • Next Page