{"library":"smartling-api-sdk-nodejs","title":"Smartling Node.js SDK","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install smartling-api-sdk-nodejs"],"cli":null},"imports":["import { SmartlingApiClientBuilder, SmartlingFilesApi, SmartlingJobsApi } from 'smartling-api-sdk-nodejs';","import { CreateJobParameters, FileType } from 'smartling-api-sdk-nodejs';","import { SmartlingApiClientBuilder, SmartlingFilesApi } from 'smartling-api-sdk-nodejs';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { SmartlingApiClientBuilder, SmartlingProjectsApi } from 'smartling-api-sdk-nodejs';\n\nconst USER_IDENTIFIER = process.env.SMARTLING_USER_IDENTIFIER ?? '';\nconst USER_SECRET = process.env.SMARTLING_USER_SECRET ?? '';\n\nif (!USER_IDENTIFIER || !USER_SECRET) {\n  console.error('Please set SMARTLING_USER_IDENTIFIER and SMARTLING_USER_SECRET environment variables.');\n  process.exit(1);\n}\n\nasync function listProjects() {\n  try {\n    const apiBuilder = new SmartlingApiClientBuilder()\n      .setLogger(console)\n      .setBaseSmartlingApiUrl('https://api.smartling.com')\n      .authWithUserIdAndUserSecret(USER_IDENTIFIER, USER_SECRET);\n\n    const projectsApi = apiBuilder.build(SmartlingProjectsApi);\n\n    console.log('Fetching Smartling projects...');\n\n    // The Projects API endpoint supports listing projects within an account.\n    // Note: The actual method for listing projects might be `getProjectsList` or similar\n    // depending on the exact API client implementation. This is a common pattern.\n    const projectsResponse = await projectsApi.getProjectsList(); // Assuming a method like getProjectsList\n\n    console.log('Successfully fetched projects:');\n    if (projectsResponse && projectsResponse.items && projectsResponse.items.length > 0) {\n      projectsResponse.items.forEach(project => {\n        console.log(`- Project Name: ${project.projectName}, Project ID: ${project.projectId}`);\n      });\n    } else {\n      console.log('No projects found or response format unexpected.');\n    }\n\n  } catch (error: any) {\n    console.error('Failed to list projects:', error.message);\n    if (error.response && error.response.data) {\n      console.error('API Error Details:', error.response.data);\n    }\n    process.exit(1);\n  }\n}\n\nlistProjects();","lang":"typescript","description":"This example initializes the Smartling API client using environment variables for authentication and then lists all accessible projects.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}