Supista
Contact Us
documentation
Supista ERP
Samples
CRUD

Create API

Below is a sample implementation of a customized Create API in Supista ERP:

async function customizeERP(userData, apiOperations) {
  const tableName = "Your Table Name";
  const { createOp } = apiOperations;
 
  return new Promise(async (resolve, reject) => {
    const payload = {
      "__d3__newData": {}
    };
 
    const createdData = await createOp(tableName, payload);
 
    resolve(createdData);
  });
}

Output structure

{
  "result": {
    "id": 12,
    "columnName1": "newValue1",
    "columnName2": "newValue2"
  }
}

Read API

Below is a sample implementation of a customized Read API in Supista ERP:

async function customizeERP(userData, apiOperations) {
  const tableName = "Your Table Name";
  const { readOp } = apiOperations;
 
  return new Promise(async (resolve, reject) => {
    const payload = {
      "__d3__filterdata": {
        "where": {}
      }
    };
 
    const rowsData = await readOp(tableName, payload);
 
    resolve(rowsData);
  });
}

Output structure

{
  "result": {
    "count": 2,
    "rows": [
      {
        "columnName1": "newValue1",
        "columnName2": "newValue2"
      },
      {
        "columnName1": "newValue1",
        "columnName2": "newValue2"
      }
    ]
  }
}

Update API

Below is a sample implementation of a customized Update API in Supista ERP:

async function customizeERP(userData, apiOperations) {
  const tableName = "Your Table Name";
  const { updateOp } = apiOperations;
 
  return new Promise(async (resolve, reject) => {
    const payload = {
      "__d3__newData": {},
      "__d3__id": 12
    };
 
    const updatedData = await updateOp(tableName, payload);
 
    resolve(updatedData);
  });
}

Output structure

{
  "result": {
    "affectedCount": [1]
  }
}

Delete API

Below is a sample implementation of a customized Delete API in Supista ERP:

async function customizeERP(userData, apiOperations) {
  const tableName = "Your Table Name";
  const { removeOp } = apiOperations;
 
  return new Promise(async (resolve, reject) => {
    const payload = {
      "__d3__id": [12]
    };
 
    const deletedData = await removeOp(tableName, payload);
 
    resolve(deletedData);
  });
}

Output structure

{
  "result": {
    "deletedObjNo": 22
  }
}
Last updated on
Transform Data into Decisions with Supista – Your Intelligent Data Partner
AI Procurement Auditor for Procure-to-Pay

Automate your daily operations. Scale your company with confidence.

Discover the gaps, risks, and inefficiencies in your procure-to-pay cycle. Book a free session with our Automation Experts and uncover how AI can transform your operations end-to-end.