### Cloud Backend API Function Invocation Source: https://support.appdrag.com/doc/Interacting-with-my-API-Functions General documentation for calling custom API functions hosted on the Cloud Backend platform. ```APIDOC ## [HTTP_METHOD] /api/[FOLDERNAME]/[FUNCTIONNAME] ### Description Invokes a custom API function created within the Cloud Backend. The route is determined by the folder and function name defined in the editor. ### Endpoint https://yourcustomdomainname.com/api/[FOLDERNAME]/[FUNCTIONNAME] https://yourprojectname.appdrag.com/api/[FOLDERNAME]/[FUNCTIONNAME] ### Parameters - **APIKey** (string) - Optional - Required if 'Require APIKey' is enabled in the function security settings. ### Method - **GET**: Pass parameters via query string. - **POST/PUT/PATCH/DELETE**: Pass parameters in the request body. ### Response #### Success Response (200) - **status** (boolean) - Indicates if the function executed successfully. - **execTime** (number) - Time taken for execution in milliseconds. - **billedTime** (number) - Time debited from the plan. - **payload** (object) - The actual response returned by the function. - **logs** (string) - Error logs, if any occurred. ``` -------------------------------- ### Automatically trigger a popup Source: https://support.appdrag.com/doc/Create-a-Popup-window Uses a script to trigger a click event on a button after the page loads and a specified timeout period. ```html ``` -------------------------------- ### Store API response data in Local Storage Source: https://support.appdrag.com/doc/Store-values-in-Local-Storage Parses a JSON response and saves the email and token to local storage if no error is present. ```javascript var obj = JSON.parse(response); if (obj.payload.error = = "EMAIL_ALREADY_USED") { $(".email-field").append("
"); } else { localStorage.setItem("email", obj.payload.email); localStorage.setItem("token", obj.payload.token); } ``` -------------------------------- ### Insert Row and Retrieve ID Source: https://support.appdrag.com/doc/Inserting-a-Row-in-the-Database Executes an SQL INSERT statement followed by a SELECT LAST_INSERT_ID() query to return the new record's ID. ```javascript var cloudbackend = require('appdrag-cloudbackend'); cloudbackend.init(APIKey, appID); cloudbackend.sqlSelect("INSERT INTO Users (name, email, password) " +"values('john doe', 'john@doe.com', 'Test97_626p'); SELECT LAST_INSERT_ID() as newUserID;") .then( function(response) { var result = JSON.parse(response); var newUserID = result.Table[0].newUserID; callback(null, newUserID); //return the newUserID }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.