Get Multiple Records with Azure Functions
This article introduces how to retrieve multiple records from a Kintone App using Azure Functions.
What is Azure Functions?
Azure Functions is a feature of Microsoft Azure. It is a serverless computing service that can run programming codes in response to triggers, similar to AWS Lambda. From the browser, cron jobs can be set up for batch processing. Node.js and C# codes can run in response from HTTP triggers (Webhooks).
Examples of using Azure Functions
Run Kintone REST APIs periodically
Set up cron expressions to periodically run codes on Azure Functions. Kintone data can be accessed with Kintone REST APIs.
Integrate with Azure services using Webhooks
Set up Kintone's webhooks with Azure Functions to integrate with various other Azure services.
Prepare the Azure Functions environment
Create an account and set up Azure Functions
Prepare an Azure Functions environment with the following steps.
Install the package modules
Follow the steps below to install the Node.js package.
Choose Advanced Tools -> Go->.
From the header, select Debug console -> CMD.
A console screen is displayed when Kudu is opened.
The package can be installed from this console.
From the directory links, navigate to the Function folder that was created.
Run the following npm command. A number of questions will be asked. Enter the name and description, and then skip the rest by holding Enter.
Install the following packages:
A node_modules folder and package.json file will be created after the installation is complete.
Open package.json and make sure that the settings are as follows:
The Function Editor
This is the Function Editor where the code will be managed.
- The Endpoint URL. Azure Functions executes the code when an HTTP request is made to this URL.
- The code editor, including the code that will run.
- An area to display context logs when the code runs.
- An area to test HTTP requests.
The following is a sample that retrieves multiple record data from Kintone and displays it in the log. Type it into the code editor of Azure Functions. Replace the values of
X-Cybozu-Authorization with the Kintone environment's URL, the target App ID, and the
Password Authentication value respectively.
Save the code and click "Run".
If the code runs successfully, data of multiple records should be retrieved from Kintone and be displayed in the log. Status "200 OK" should also be displayed.