index.md 1.6 KB


Feel free to add content and custom Front Matter to this file.

To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

layout: default

Lokalise APIv2 Node interface

Install the library using NPM:

npm install @lokalise/node-api

Obtain Lokalise API token in your personal profile, initialize and use the client:

const { LokaliseApi } = require('@lokalise/node-api');

const lokaliseApi = new LokaliseApi({ apiKey: '<apiKey>'});
const projects = await lokaliseApi.projects().list();
projects.items[0].name;

process = await lokaliseApi.files().upload(project_id,
  {data: data_base64, filename: 'test1.json', lang_iso: 'en'})
process.status // => 'queued'

Alternatively, you can use tokens obtained via OAuth2 (don't forget that these tokens have expiration dates):

const { LokaliseApiOAuth } = require('@lokalise/node-api');

const lokaliseApi = new LokaliseApiOAuth({ apiKey: '<apiKeyObtainedViaOauth2>' });

const projects = lokaliseApi.projects().list();

You can also check this repo containing some usage examples and this blog post with explanations.

Usage

{% include nav_full.html %}

Additional info

{% include nav_full_additional.html %}