Lokalise APIv2 Node SDK

Node interface for the Lokalise APIv2.

View the Project on GitHub lokalise/node-lokalise-api




Contributors

Contributor attributes

Fetch contributors

API doc

const contributors = await lokaliseApi.contributors().list({
  project_id: project_id,
  page: 2,
  limit: 3
});

contributors.items[0].user_id;

Fetch a single contributor

API doc

const contributor = await lokaliseApi.contributors().get(user_id, {project_id: project_id});

contributor.email;

Fetch current contributor (token-based)

API doc

This endpoint returns contributor in the given project based on the user whose token is used to send the request. In other words, it returns information about self in scope of a project.

const current_contributor = await lokaliseApi.contributors().me({
  project_id: projectId,
});

current_contributor.fullname; // => "John Doe"

Create contributors

API doc

const contributors = await lokaliseApi.contributors().create([
  {
    "email": "translator2@mycompany.com",
    "fullname": "Mr. Translator",
    "is_admin": false,
    "is_reviewer": true,
    "languages": [
      {
        "lang_iso": "en",
        "is_writable": false
      }
    ]
  }
], {project_id: project_id});

contributors[0].user_id

Update contributor

API doc

const contributor = await lokaliseApi.contributors().update(
  user_id,
  {is_admin: true},
  {project_id: project_id}
);

contributor.user_id;

Delete contributor

API doc

const response = await lokaliseApi.contributors().delete(user_id, {project_id: project_id});

response.contributor_deleted;