How to dynamically display a list of Companies from Bigin to a (WordPress) web page

How to dynamically display a list of Companies from Bigin to a (WordPress) web page

Hi All,

I believe I have, what should be, a super simple technical challenge.

I'd like to be able to dynamically (on-demand) READ a list of Companies from our Bigin account, and display their names on a web page. It's all read-only server-side stuff, no human interaction required.

Reason: we have a business that rents out rooms to small businesses, and some of them would like to be advertised on a tenant directory on our website, so I'd like to help them with that.

I've reached out directly to Bigin support, but so far it's not clear to me whether they aren't able to help me because what I'm asking is not technically possible (surely not?) or it's not clear what I'm asking, or some other reason.

Of course Bigin has an API, and using COQL (CRM Object Query Language) as a Query API seems like it should be able to do exactly what I need:

https://www.bigin.com/developer/docs/apis/v2/coql-overview.html

I'm a former PHP developer, but these days I get ChatGPT to write the code that I need for simple actions, reports etc.

So the code SHOULD IMHO look something like this:

  1. <?php

    // Bigin CRM API endpoint for COQL queries
    $api_url = "https://www.zohoapis.com/bigin/v1/coql";

    // Your Bigin CRM API authentication token
    $auth_token = "YOUR_AUTH_TOKEN";

    // COQL query to fetch company names
    $query = json_encode([
        "select_query" => "SELECT Company_Name FROM Companies"
    ]);

    // cURL initialization
    $ch = curl_init($api_url);

    // cURL options
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Zoho-oauthtoken $auth_token",
        "Content-Type: application/json"
    ]);

    // Execute cURL request and fetch response
    $response = curl_exec($ch);

    // Check for cURL errors
    if (curl_errno($ch)) {
        echo "cURL Error: " . curl_error($ch);
        curl_close($ch);
        exit;
    }

    // Close cURL resource
    curl_close($ch);

    // Decode JSON response
    $response_data = json_decode($response, true);

    // Check for API errors
    if (isset($response_data['code'])) {
        echo "API Error: " . $response_data['message'];
        exit;
    }

    // Display company names on the web page
    if (isset($response_data['data'])) {
        echo "<h1>Company Names</h1>";
        echo "<ul>";
        foreach ($response_data['data'] as $company) {
            echo "<li>" . htmlspecialchars($company['Company_Name']) . "</li>";
        }
        echo "</ul>";
    } else {
        echo "No company names found.";
    }
    ?>

I've pointed out to Bigin support that it's very common for companies with APIs to share sample scripts for multiple different coding languages, to help developers and would-be developers to get started, e.g. like this:

https://docs.perplexity.ai/reference/post_chat_completions

Has anyone else been able to achieve what I want to achieve, or similar? If so, can you give me some guidance?

Thanks!

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now