ocean-apis-sdk
v1.0.12
Published
A Node.js SDK for Invincible Ocean API's
Downloads
35
Readme
# Ocean APIs SDK
Ocean APIs SDK is a Node.js SDK that provides simple access to Ocean API services, such as PAN verification and OCR processing.
## Installation
To install the SDK, use npm:
```bash
npm install ocean-apis-sdk
Initialization
To use the SDK, initialize it with your clientId
and secretKey
. These keys are provided by Invincible Ocean to access their APIs.
const { Apis } = require('ocean-apis-sdk');
// Initialize the SDK with your clientId and secretKey
const apis = new Apis('yourClientId', 'yourSecretKey');
API Methods
1. PAN Verification
Verify PAN number using the verifyPan
method.
Example:
async function verifyPan() {
try {
const result = await apis.verifyPan('ABCDE1234F'); // Replace with the actual PAN number
console.log('PAN Verification Result:', result);
} catch (error) {
console.error('Error during PAN verification:', error.message);
}
}
verifyPan();
2. Global OCR
Use the globalOcr
method to extract text from front and back images of documents.
Example:
async function performOcr() {
try {
const frontImagePath = './path/to/front-image.jpg'; // Provide the path to the front image
const backImagePath = './path/to/back-image.jpg'; // Provide the path to the back image
const ocrResult = await apis.globalOcr(frontImagePath, backImagePath);
console.log('OCR Result:', ocrResult);
} catch (error) {
console.error('Error during OCR processing:', error.message);
}
}
performOcr();
Environment Variables
You can optionally configure your clientId
and secretKey
using environment variables. To do this, create a .env
file in the root of your project and add the following:
CLIENT_ID=yourClientId
SECRET_KEY=yourSecretKey
Then you can initialize the SDK like this:
require('dotenv').config(); // Load environment variables from .env file
const { Apis } = require('ocean-apis-sdk');
const apis = new Apis(process.env.CLIENT_ID, process.env.SECRET_KEY);
Documentation
Visit the official website for more detailed API documentation: Ocean APIs Documentation.
Support
For any support or queries, please contact us at:
- Email: [email protected]
- Website: Invincible Ocean Dashboard
License
This SDK is licensed under the MIT License. See the LICENSE file for more information.