Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Translation Endpoint in REST-API not working #4798

Closed
Julian-Schaefer opened this issue Nov 2, 2020 · 7 comments
Closed

Automatic Translation Endpoint in REST-API not working #4798

Julian-Schaefer opened this issue Nov 2, 2020 · 7 comments
Labels
question This is more a question for the support than an issue.
Milestone

Comments

@Julian-Schaefer
Copy link

Hello there,

in the Documentation of Weblate's REST-API, there is an Endpoint to trigger the automatic Translation of a Component for a specific language (see Automatic Translation Endpoint).

However, when I try to use the Endpoint, I receive the following Error Message:

Status: 405 Method not allowed
Response:
{
"detail": "Method "GET" not allowed."
}

Screenshot:
weblate-error

I also made sure to install the Automatic Translation Add-On in the specific Component, however it is still not working.
installedaddon

Any help on this will be greatly appreciated! Thanks.

Weblate-Version:
4.3.1

@nijel
Copy link
Member

nijel commented Nov 2, 2020

The docs clearly states that you should use POST, not GET....

@nijel nijel added the question This is more a question for the support than an issue. label Nov 2, 2020
@github-actions
Copy link

github-actions bot commented Nov 2, 2020

This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger. In case your question is already answered, making a donation is the right way to say thank you!

@Julian-Schaefer
Copy link
Author

I did use "POST", that's what makes it even more confusing...

2020-11-02_14h21_14

@nijel
Copy link
Member

nijel commented Nov 2, 2020

It ends up being performed as GET, maybe the URL is missing trailing slash and it gets redirected?

nijel added a commit that referenced this issue Nov 2, 2020
Stop using Django's CommonMiddleware - it does redirect for all methods
what leads to failure on API and other non GET endpoints.

See #4798
@Julian-Schaefer
Copy link
Author

Stupid me, that was actually the issue, thank you very much!

@github-actions
Copy link

github-actions bot commented Nov 3, 2020

The issue you have reported is resolved now. If you don’t feel it’s right, please follow it’s labels to get a clue and take further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@nijel nijel added this to the 4.3.2 milestone Nov 3, 2020
@nijel
Copy link
Member

nijel commented Nov 3, 2020

I've adjusted the middleware to avoid redirects on POST in 41c2bdb as that seems to be quite frequent mistake and properly returning 404 in that case might make it more likely people will look at the URL ;-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is more a question for the support than an issue.
Projects
None yet
Development

No branches or pull requests

2 participants