Registry / communication / smartling-api-sdk-nodejs

smartling-api-sdk-nodejs

JSON →
library2.31.0jsnpmunverified

The `smartling-api-sdk-nodejs` package provides a Node.js SDK for programmatically interacting with the Smartling Translation API, automating content internationalization and localization workflows. It enables developers to upload source files, manage translation jobs, and download translated content in various languages. This SDK (currently at version 2.31.0) is actively maintained and typically follows a continuous release cadence with new features and bug fixes. It serves as a client library to simplify accessing Smartling's underlying REST APIs, covering functionalities like authentication, accounts, projects, files, and jobs. Key differentiators include streamlining content synchronization with Smartling's Translation Management System (TMS) and offering specialized APIs for common use cases like Jobs and Files, though it provides less comprehensive API coverage than the Java SDK.

npm install smartling-api-sdk-nodejs
INSTALL
IMPORT
SIG · SMARTLING-API-SDK-
S
smartling-api-sdk-nodejs
communicationjavascriptv2.31.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SmartlingApiClientBuilder
import { SmartlingApiClientBuilder, SmartlingFilesApi, SmartlingJobsApi } from 'smartling-api-sdk-nodejs';
const { SmartlingApiClientBuilder } = require('smartling-api-sdk-nodejs');
ESM imports are the preferred syntax for versions 2.x.x and later, requiring Node.js >= 18. CommonJS `require` is generally discouraged for newer projects but may work for some older setups.
CreateJobParameters
import { CreateJobParameters, FileType } from 'smartling-api-sdk-nodejs';
import CreateJobParameters from 'smartling-api-sdk-nodejs';
Most API-specific parameter classes and enums are named exports, not default exports. Always use named imports with curly braces.
SmartlingFilesApi
import { SmartlingApiClientBuilder, SmartlingFilesApi } from 'smartling-api-sdk-nodejs';
import { FilesApi } from 'smartling-api-sdk-nodejs';
API service clients are typically prefixed with 'Smartling' (e.g., `SmartlingFilesApi`, `SmartlingJobsApi`) to avoid naming conflicts.

This example initializes the Smartling API client using environment variables for authentication and then lists all accessible projects.

import { SmartlingApiClientBuilder, SmartlingProjectsApi } from 'smartling-api-sdk-nodejs'; const USER_IDENTIFIER = process.env.SMARTLING_USER_IDENTIFIER ?? ''; const USER_SECRET = process.env.SMARTLING_USER_SECRET ?? ''; if (!USER_IDENTIFIER || !USER_SECRET) { console.error('Please set SMARTLING_USER_IDENTIFIER and SMARTLING_USER_SECRET environment variables.'); process.exit(1); } async function listProjects() { try { const apiBuilder = new SmartlingApiClientBuilder() .setLogger(console) .setBaseSmartlingApiUrl('https://api.smartling.com') .authWithUserIdAndUserSecret(USER_IDENTIFIER, USER_SECRET); const projectsApi = apiBuilder.build(SmartlingProjectsApi); console.log('Fetching Smartling projects...'); // The Projects API endpoint supports listing projects within an account. // Note: The actual method for listing projects might be `getProjectsList` or similar // depending on the exact API client implementation. This is a common pattern. const projectsResponse = await projectsApi.getProjectsList(); // Assuming a method like getProjectsList console.log('Successfully fetched projects:'); if (projectsResponse && projectsResponse.items && projectsResponse.items.length > 0) { projectsResponse.items.forEach(project => { console.log(`- Project Name: ${project.projectName}, Project ID: ${project.projectId}`); }); } else { console.log('No projects found or response format unexpected.'); } } catch (error: any) { console.error('Failed to list projects:', error.message); if (error.response && error.response.data) { console.error('API Error Details:', error.response.data); } process.exit(1); } } listProjects();
Debug
Known issues
breakingVersion 2.x.x of the SDK requires Node.js version 18 or greater. Projects on older Node.js runtimes (e.g., Node.js 16) must use SDK version 1.x.x or upgrade their Node.js environment.
fix
Upgrade Node.js to version 18 or newer, or downgrade `smartling-api-sdk-nodejs` to a 1.x.x release (e.g., `npm install smartling-api-sdk-nodejs@^1`).
affects: >=2.0.0
gotchaAuthentication requires a user identifier and user secret, which function as API tokens. These credentials grant broad access to your Smartling account and projects, so they should be managed securely, preferably via environment variables or a secrets manager.
fix
Never hardcode API credentials directly in source code. Use environment variables (e.g., `process.env.SMARTLING_USER_IDENTIFIER`) or a secure secret management system.
affects: >=1.0.0
gotchaThe SDK provides separate clients for different API services (e.g., `SmartlingFilesApi`, `SmartlingJobsApi`). Ensure you instantiate and use the correct API client for the specific operation you intend to perform.
fix
When building API clients, use `apiBuilder.build(Smartling[Service]Api)` with the specific service class (e.g., `SmartlingFilesApi`) corresponding to your API call.
affects: >=1.0.0
gotchaMany API operations, especially file and job-related ones, require a `projectId`. Neglecting to provide a valid `projectId` in the client configuration or method calls will result in errors.
fix
Ensure you have a valid Smartling Project ID and pass it to the relevant API client builder or method parameters as required by the specific API endpoint.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... Not supported by require().
Attempting to use CommonJS `require()` syntax with version 2.x.x of the SDK, which is primarily designed for ESM and Node.js >= 18.
fix
Convert your project or the relevant files to use ES Module `import` syntax (e.g., `import { Name } from 'pkg';`). Ensure your `package.json` specifies `"type": "module"` or use `.mjs` file extensions. If unable to upgrade, use a 1.x.x version of the SDK.
Failed to list projects: Request failed with status code 401
Unauthorized access due to invalid or missing Smartling API user identifier or secret.
fix
Verify that `SMARTLING_USER_IDENTIFIER` and `SMARTLING_USER_SECRET` environment variables are correctly set and contain valid credentials. Regenerate tokens if necessary from the Smartling dashboard.
Failed to list projects: Project ID is required
An API method was called that requires a `projectId`, but it was not provided during client instantiation or as a method parameter.
fix
Ensure you are passing the correct `projectId` to the `SmartlingApiClientBuilder`'s `setProjectId()` method if it's a global client setting, or as a parameter to the specific API method call.
Upgrade
Version history
2.31.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Bingbot
1
OpenAI (training)
1
Resources
smartling-api-sdk-nodejs — npm install smartling-api-sdk-nodejs · libregistry