Thursday, February 6, 2025

API Configration

Get API

let pURL = "https://apextest.interloop.com.pk:8443/ords/oratest/il248735/3000/SMPL/";

const getData = async () => {

    let response = await fetch(pURL);

    console.log(response); //getting Response

    let returnResponse = await response.json();//second parameter to get Use Able Data from Response

    for (i = 0; i <= returnResponse.count; i++) {

        //console.log(returnResponse.count);

        console.log(returnResponse.items[i]);

    }

}

getData();

Post API

let pTrandtlpk = 74928,

pLMSID = 1;

let pURL = "https://apextest.interloop.com.pk:8443/ords/oratest/il248735/3001/" + pTrandtlpk  + '/' + pLMSID;

const getData = async () => {

    let promise = await fetch(pURL, {

        method: "POST",

        headers: {

            'Content-Type': 'application/x-www-form-urlencoded'

        }

    });

    console.log(promise);

    if (promise.ok) {

     apex.message.alert("Data has been Updated");   

    }

    else{

        apex.message.alert("SomeThing Wrong in Fetch API")

    }

}

getData()

API Configration Get API let pURL = "https://apextest.interloop.com.pk:8443/ords/oratest/il248735/3000/SMPL/"; const getData = asy...