▶️ Production-ready today
As an example, our Figma plugin for Localazy revolves around API and shows that you can use it to build powerful plugins and tools. However, it may be daunting to start as REST-based API generally provides only basic functionality and complex logic needs to be built on top of it. Therefore, starting from scratch will generally include studying the documentation, trying out various endpoints, inspecting responses, and then creating some kind of personal library to abstract some of the complexity.
📚 TypeScript library to get you started
Well, if you're going to use either JavaScript or TypeScript, you're in luck! We've built a zero-dependency library that takes care of the basic concepts such as authentication or type definition. The library provides several methods that should cover most of your needs.
You just need to install it as a dependency in your project to get started.
npm install @localazy/ts-api
Afterward, import the library and initialize it.
import LocalazyApi from '@localazy/ts-api';
const api = LocalazyApi({
projectToken: "your-project-token"
// ...additional options
})
That's it. You can immediately begin to fetch data from Localazy, such as a list of projects with listProjects
the method, all the keys for a given project, file, and language with listKeysInFileForLanguage
and then upload modified content with import
.
See the project's GitHub page for an overview of all the supported methods. Or head over to this article about the dynamic localization of ad banners to see this library in action.
Project token
To access anything from Localazy, you need to sign up and create a project. Then, you'll be able to generate a project token here. See documentation for more information.
✔️ Closing words
We hope this small library will help you get the best of Localazy API.
To see the complete list of supported methods or to report a bug/feature request, please head to GitHub. Don't hesitate to contact us via team@localazy.com or join our Discord channel if you have any questions. Happy coding!
Top comments (0)