Search code examples
weblate

Adding a Unit in Weblate using the REST-API not working


i am writing a tool that scans a codebase for strings and i want to add them to a self-hosted weblate instance via unit add. For that i am using a POST /api/translations/(string: project)/(string: component)/(string: language)/units/ request. The authkey is set and is working (tested a wrong authkey and got a different error message). But i am getting an 403 with {"detail":"Can not add unit"}. Is it possible that one of my coworkers set a configuration that forbids adding a unit via API? The request json looks as follows: "key": "workingkey", "source": "Test", "state": 100,

I tried the request but got a 403 with {"detail":"Can not add unit"} instead of the 201.


Solution

  • There can be several reasons why you cannot add a unit. Weblate 4.18 and newer will tell you more detailed reason in the error message, see https://github.com/WeblateOrg/weblate/issues/9073