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

REST API access from LAN network #37

Closed
MartinHajducik opened this issue May 26, 2022 · 4 comments
Closed

REST API access from LAN network #37

MartinHajducik opened this issue May 26, 2022 · 4 comments

Comments

@MartinHajducik
Copy link

Greetings all,

We are trying to access REST API from LAN network, but seems somehow access is restricted only to localhost requests. is there a way how to configure it ?

2022-05-26 09:58:11.479 +02:00 [INF] Started HTTP API at http:https://localhost:8500. This API cannot be accessed from remote computers.

Thanks for help in advance
Regards
Martin

@TommiNieminen
Copy link
Collaborator

Hi,

You need to reserve the URL with netsh for it to work outside of localhost (or you can run the MT engine as admin, but that's never a good idea). Here's the command to use (this needs to be executed in a command prompt with admin rights):

netsh http add urlacl url=http:https://+:8500/ user=_DOMAIN_\_username_

Substitute domain or computer name for DOMAIN and your user name for username. There may be some firewall configuration required in addition to that (but I think it might be handled by a prompt when you start the MT engine after running netsh).

@MartinHajducik
Copy link
Author

Hi,

You need to reserve the URL with netsh for it to work outside of localhost (or you can run the MT engine as admin, but that's never a good idea). Here's the command to use (this needs to be executed in a command prompt with admin rights):

netsh http add urlacl url=http:https://+:8500/ user=_DOMAIN_\_username_

Substitute domain or computer name for DOMAIN and your user name for username. There may be some firewall configuration required in addition to that (but I think it might be handled by a prompt when you start the MT engine after running netsh).

Indeed. Thanks that worked ! Now I am facing little bit different issue. When calling MTRestService/ListSupportedLanguagePairs , I am getting following response

`

<TITLE>Bad Request</TITLE>

Bad Request - Invalid URL


HTTP Error 400. The request URL is invalid.

`

Am I doing something wrong ?

@TommiNieminen
Copy link
Collaborator

Hi,

Looks like you need to specify the tokenCode parameter in the request. The tokenCode is not actually used, it's just a leftover from the API code that I used as the basis of the OPUS-CAT API, but it's still required. I've fixed this in the code, so in future versions the tokenCode should not be required, but for now, you can include tokenCode=0 or some other tokenCode value in the request. I should probably rework the API, currently even the name is misleading, since it's not an actual REST API (I'll keep it backwards compatible, though).

-Tommi

@MartinHajducik
Copy link
Author

tokenCode=0

Yes, it works now ! Once again thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants