Skip to main content

Javascript SDK

Overview

The Anansi Java SDK provides an interface for interacting with Anansi, a powerful visual data lineage tool. This SDK enables users to seamlessly retrieve and post data from Anansi using Java SDK. The SDK documentation includes API endpoints for fetching,patching,posting and deleting data from Anansi.

Installation

npm i @anansi-lineage/anansi-sdk

Example Usage

Get Data from Anansi

To retrieve data from Anansi, follow these steps:

  1. Initialization

const { ApiClient, DefaultApi } = require("@anansi-lineage/anansi-sdk");

var apiClient = new ApiClient();
apiClient.basePath = "YOUR_API_CLIENT";

apiClient.authentications["JWT"].apiKey = "YOUR_API_KEY";
apiClient.authentications["JWT"].apiKeyPrefix = "Bearer";

const defaultClient = new DefaultApi(apiClient);
let tableName = "YOUR_TABLE_NAME";

let receivedData; // Variable to store received data

// Function to set received data
const setData = (data) => {
receivedData = data;
};

  1. Prepare Query Parameters

const fetchData = async (defaultClient, tableName) => {
async function fetchRawData() {
let callback = function (error, data, response) {
if (error) {
console.error(error);
} else {
setData(data);
console.log("Data received:", data);
}
};
try {
console.log("Fetching data for table:", tableName);
defaultClient.getCatalogTablename(
1000, //Limit
0, //Skip
tableName,
{ optionalFilter: "" },
callback
);
} catch (err) {
console.log("Error occurred:", err);
}
}
await fetchRawData(defaultClient, tableName);
};

fetchData(defaultClient, tableName);
note
  • Replace "YOUR_API_KEY" with your actual API key and "YOUR_TABLE_NAME" with the name of the table from which you want to fetch details.

  • Replace "YOUR_API_CLIENT" with the appropriate value for your API client.

  • You can also adjust the values of "Limit" and "Skip" as needed.

  • If desired, optional parameters can be passed to filter the query further.