Advanced Node SDK Migration Guide
Based on customer feedback, we have been working on improving our all-category SDKs. We recently released our Advanced Node SDK. It is currently available for anyone to use.
Note that the existing Node SDKs are fully functional and will continue to work.
There are key benefits in using this Advanced SDK. We understand that migrating will take both time and effort, which is why we’ve worked on putting together this helpful migration guide.
We strongly recommend to use the new SDKs. You’ll play an integral role in providing feedback on our SDKs, making them more usable and robust and get a head start on migrating over.
We would love any and all feedback by reaching out to your engagement manager or [email protected]. All your feedback will be promptly addressed.
Migration Guide
This guide is for Merge customers using the gen-0 and gen-1 Node SDKs:
Generation | SDK Name | github | package name |
0 | HRIS Node |
| |
0 | ATS Node |
| |
0 | Accounting Node |
| |
0 | Ticketing Node |
| |
1 | Typescript multi-category |
|
We recommend all customers move to the Advanced SDK:
package manager:
npm install --save @mergeapi/merge-node-client
# or
yarn add @mergeapi/merge-node-client
This SDK has the following advantages:
Feature | Description |
Better base request library | The earlier typescript multicategory SDK relied on node-fetch as the core request library. This has some problems including adding extra support if using Node version < 17.5. The new SDK uses axios as its core requests library. |
Fewer dependencies | The new SDK is more lightweight in required dependencies allowing for more developer flexibility with the core application. |
Tests | This SDK ships with a much more comprehensive set of unit tests compared with the prior SDK. |
This SDK has all Merge categories, which makes it easy for Merge customers to find all endpoint methods in one package. The earlier single-category SDKs as well as the multi-category SDK all have the same style of method call, so let’s consider what it looks like to move from an existing employees list call to the new SDK.
Earlier SDK Code
const confAts = new Configuration({
apiKey: "REDACTED-YourAPIKeyWithMerge",
accessToken: "REDACTED-YourCustomer1Key"
});
const candidatesApi = new merge_sdk.ATS.CandidatesApi(confAts);
// lists ats candidates for customer 1
let response = await candidatesApi.candidatesList({}).catch((reason) => {
console.log(reason);
});
console.log(response);
Advanced SDK Equivalent
import { MergeClient, Merge } from '@mergeapi/merge-node-client';
const merge = new MergeClient({
apiKey: 'YOUR_API_KEY',
accountToken: 'YOUR_ACCOUNT_TOKEN',
});
candidate = await merge.ats.candidates.list().catch((reason) => {
console.log(reason);
});
console.log(response);
Here are some key advantages from the new client class:
Authentication configuration has been somewhat simplified, you do not need to specify
"Bearer"
prefix anymore as it is assumed.Pagination is easier, there are helper methods to pull the cursor out and pass it back in to pull the next page.