Localization Academy

How To Start With POEditor API

Learn the basics of POEditor API in this video tutorial. From creating projects to adding terms and contributors – I’ve done it all.

But I didn’t stop there. I put Lokalise to a small test with 100 iterations run in Postman to really see what it’s made of. Performance? You’ll just have to watch to find out.

Andrej Zito 

Hey guys, in this video, I’m going to show you a quick tutorial how you can get started with POEditor’s API, we’re going to run a few tests, and you’re going to see how it performs, which means we can also compare it now to localize which I did in the previous video. So let’s get started here in postman, you can see the collection of the requests that I have created, we have 123456789 requests to create a project, add languages, add the terms into this project. And then to add two contributors for German and Japanese. First, let me show you how to create a project in PL editor. It’s very simple. This is the URL that we use, of course, it’s a post request, although it’s not as typical as we would expect, even if you want to just list some things. So you want to read some data, you still have to use POST request. For some reason, I’m not sure why that is happening. Because in pretty much every API, and there are not many API’s that I use, just to be honest with you. So I’m still kind of like a beginner. When it comes to API, usually you have a mix of at least GET and POST methods get, of course use if you don’t need to update anything or create any resources on the server. But for some reason, with P auditor, even if you just want to read data, you have to use POST anyway, back to our project creation. So just like before, we have this like a variable collection around which is going to change the way our projects are named. And the project creation is very simple. You just use this URL, you attach your API token, and then you have to select a name for your project. Normally, I’m used to having the API token used in the headers in most of the cases where in postman, you can just set it up here in your authorization, which is what we did for localized for pure error, I had to put it manually into every request, because I’m not sure how I can add this once for all the requests in postman. So that could just be me. But again, another thing for you to be mined for off. And then once we create the project, what we are doing is we are storing the project ID into the variable project ID, which then we can use in pretty much all of the subsequent requests, because that’s how you add languages add terms to that particular project. So moving on, we have to add the languages for our project, again, compared to localize where you could do that in one request, you can see here, I selected the name of the project, I selected the base language, which in your editor is called reference language. And then we added the other languages here, you actually cannot set the languages of the project in the Project creation requests, you have to call separate endpoints for debt. And another I think, questionable decision for me is, as you can see here, that’s why we have three requests, one for each language is that you cannot even pass an array of languages if you want to add languages to your project. So you have to call the API three times instead of ones even though the only thing that changes is this little thing here. So again, this is something that I’m surprised, I’m not sure what’s the decision behind that. Again, I’m not a super technical expert, I’m not a developer, my experience with API is kind of limited. But this is what I would expect from very basic and unknown development point of view to be able to add multiple languages to the project so that you don’t have to call the API that many times. But otherwise, it’s very simple. It’s again, a post request, you attach your API token, use the ID, which is our project ID, this will be for all the languages and then you just add the language scope. So we do this for English, German, and Japanese. And then we update project to set the English United States as the reference language. So another maybe suggestion is that when you are adding the languages, at least if I was able to already set the language as a reference when I’m adding the language, but this time, I have to do it again, in a separate request. Moving on to adding terms, the reason why we are not uploading the file is very interesting. Again, I would see this as maybe another white important distinction between localize and feel better, and that is that you can actually upload a physical file to Pio editor, which is what I did here. So this is where I have my spreadsheet and I uploaded it as a spreadsheet that contains the terms and let’s see translations for the English which is the reference language, which basically means it’s not a translation per se, like something was translated from one language to another one, but it’s let’s say a reference string source string that we know in the standard localization world. So the problem with this is that here you can see project flow. And that is that you can send only one request every 20 seconds. So if I wanted to upload this files multiple times after each other, I would have to wait 20 seconds, or I would just get a failed request, I think it’s something like you tried too many times, or you have too many requests. Another interesting thing that I’ve noticed is that the right here at the beginning of the documentation, which by the way, is very beautiful, the style that you can see everywhere on the peel editors website, I really love it. Although I’m not sure if this is, let’s say the style that developers would typically look for. But here it says that your editors API has an open API specification, you can find a document on swagger hub, and which is where I go there for projects upload, which is the one that I showed just now here, the note is that no more than one request can be sent every 30 seconds. So there’s a little bit of discrepancy of 10 seconds between these two documentations for the same function or endpoint, which is the upload and since we want to run our horror collection 100 times having the Upload File function would really prolong the election run. And that would also affect how much time is needed to run through one iteration of all the requests. And because then it wouldn’t technically be fair to localize I decided to change this Upload File function. And instead of that, simply add the terms, let’s say manually, even though that’s pretty much what the upload file has. So this file that I have here pretty much just contains a bunch of terms and translations, where by the way, the translations are the same as the terms, which is what we’re doing exactly here. So these are separate functions, separate requests that pretty much in essence, do the same thing as uploading the basic spreadsheet that I have here. So here you can see we have the same keys as before the token and ID and then we have the data, which is actually JSON string. So here you can see a list of all the terms that we are adding to the project, I believe it’s 100. And then in the next one, we are adding the translations quote, unquote, for the English, which is the reference language so that it shows that English has been translated, even though the English has pretty much the same string as the term itself. That’s what we’re doing here. And finally, to wrap it up, we are adding contributors for German and Japanese, which are our two languages that we edit. And besides the standard keys, we have the name of the person, the email and the language that they’re taking care of. Normally, you know that in my usual EMS testing videos, I typically stick to three languages, German, Japanese, in Czech, and the reason why I decided to remove Czech is because I want to stay within a certain limit of how many requests we have, because I’m still using postman free version, which I think is limited to 1000 requests. Since we want to run this whole thing 100 times, it means we have to stay under 10 requests, because otherwise we would probably blow it out of the limits. So that’s why I decided to remove check. And that’s actually maybe interesting thing. Another comparison that I forgot to mention same as with adding the languages when it comes to adding contributors. With localize, you can do that in one request. While here for pod, you have to do one requests for each language. Now after I set everything, let me quickly show you the starting position where we are in the dashboard. So this is just one US project that I did when I was preparing for this video. Otherwise, we don’t have anything else there. So going back to postman, let’s run our collection 100 times think we want to persist the responses, and we can go

Andrej Zito 

Alright, we’re back and all the 100 iterations have completed. Let me scroll all the way up very first one case of this is how the response looks like. So we started with project number two from postman, we ended the languages, we added the terms you can see here that 100 terms were parsed. We added the translations, and then we added the contributors just to make it clear here is how the dashboard looks like now so you can see the project starting from number two and Dunton turn all the way to 101. So that’s our one on projects. I’m Yopa may be the second one. So you can see English us is our ruefulness language which are already is translated to 100%. And then we have German Japanese with the two contributors. And if I open English US, you can see that the translations, quote, unquote, were added as well. Now finally, let me open the calculator. So we have in total, seven minutes, 21 seconds for a whole collection run of 100 iterations, that is 16 times seven plus 21 divided by 100. And that gives us four seconds, or in 41 per one run, which is still slightly higher than what we had localized where I believe we ended up with four seconds point 35. Now one thing that you actually have to keep in mind that we still excluded check languages, which would still add two extra requests to this one. So in a way, it is taking longer and we don’t even have let’s say the same scope as we did for localize because we’re missing Czech and I guess all of this comes down to what I was saying earlier is that I quite don’t understand why adding the languages has to be done one by one the same for to contributes and with that, I’m going to thank you for watching this video. I hope it was useful to you in any case, give it a go on your own just like with localized, it’s very easy to start with you editor you just get your free trial account and there is pretty flexible API usage that you can do within your free trial account so you can try everything that I showed you and experience it for yourself. Thanks for watching. See you in the next one.

We’re always creating new localization content

Make sure you don’t miss anything. Join 4226 other professionals on our mailing list and be the first to get our upcoming newsletter. 

If you enjoyed that, you’ll love these…