1
0
-1

can i am updating the app_message Table using the below api in javascript

https://your_cloud_name/jw/web/json/console/app/your_app_Name/app_version/message/submit
and it is working
is it safe to use.


My team is Saying that Updating the Database with this api is Not proper for the Application Security 

because it can get expose to the outside users.

And if Joget shut Down the Internal Use of that API then it will create a big problem. 


$(document).ready(function(){
        function post_data(){
      const url = "https://your_cloud_name/jw/web/json/console/app/your_app_name/app_version/message/submit";

    // Replace the following data with your actual payload
    const payload = {
        locale: "ja_JP",
        data: JSON.stringify([
            {"id":`${$('[name=ouid]')}`,"key":`${$('#message_key').val()}`,"value":`${$('#new_value').val()}`}
        ]),
    };

    const headers = {
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
        // Add more headers as needed
    };

    fetch(url, {
                method: "POST",
                headers: headers,
                body: new URLSearchParams(payload).toString(),
            })
            .then(response => {
                console.log("Status Code:", response.status);
                return response.text();
            })
            .then(data => {
                console.log("Response Content:", data);
                window.location.href = "https://your_cloud_name/jw/web/json/console/app/your_app_name/app_version/message/submit";
        
            })
            .catch(error => {
                console.error("Error:", error);
            });
    }
        
    $('.click').click(post_data);
})

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      You can also use API Builder and invoke the call from your external server's server level. This will be safer as you won't be exposing any API credential to your end users.

      1. Mohammad Huzaif Khot

        I Cannot Create API on Joget Internally Created Table like i can only create API on the Forms which starts from app_fd that i have created. But in this Case the Table is Maintained By Joget.

      CommentAdd your comment...