Javascript (Node/Browser)

If you’re working with the Browser or Node.js, the official @mercoa/javascript package is the easiest way to interact with the Mercoa API.

The SDK is written in TypeScript and includes type definitions for all resources, requests, and responses.

Installation

$npm install --save @mercoa/javascript
># or
>yarn add @mercoa/javascript

Initialization

1import { Mercoa, MercoaClient } from "@mercoa/javascript"
2
3// If using on the server with Node.js
4const mercoa = new MercoaClient({
5 token: 'YOUR_API_KEY',
6});
7
8// If using in the browser
9const mercoa = new MercoaClient({
10 token: 'YOUR_CLIENT_JWT',
11});
12
13const entity = mercoa.entity.get("YOUR_ENTITY_ID")
14
15console.log(entity)