![]() |
Microsoft Translator Text API v3.0
Liste der Anhänge anzeigen (Anzahl: 2)
Hallo zusammen,
Ich probiere jetzt schon seit einer geraumen Weile mit dem RestDebugger die neue Translator API von Microsoft (Version 3.0) anzusprechen. Der Grund dafür ist dass die alte API Version 2.0 per 30. April 2019 eingestellt wird. ![]() Es gelingt mir einfach nicht, die API zu einem Resultat zu bewegen. Ich kriege nur immer die Fehlermeldung: "One of the request inputs is not valid" Im Anhang seht ihr wie ich den RestDebugger konfiguriert habe. Ich glaube alles richtig zu machen. Kann mir dasy jemand weiterhelfen? |
AW: Microsoft Translator Text API v3.0
(ignoriert mich)
|
AW: Microsoft Translator Text API v3.0
Meines Wissens musst du dich zuerst mit Ocp-Apim-Subscription-Key authentifizieren (liefert ein Token zurück) und mit diesem Token musst du die folgenden Aufrufe autorisieren. Das Token ist 10 Minuten gültig, dann musst du eines neues beantragen.
|
AW: Microsoft Translator Text API v3.0
Zitat:
Zitat:
"The request is not authorized because credentials are missing or invalid" So authorisation works in my opinion. Btw in the c# demo project that works well too. I assume that the problem comes from the request body parameter: [{"Text":"I would really like to drive your car around the block a few times."}] in the request content body there should be a json array with a "Text" property. I copied the json above from the microsoft translator API website. In the c# project that works well. It must have something to do how the RestDebugger (TRestRequest) handles the request.content. |
AW: Microsoft Translator Text API v3.0
Man kann sich mit drei verschiedenen Methoden authentifizieren. ICh nutze die Methode mit Ocp-Apim-Subscription-Key im request header. Das funktioniert tiptop mit dem c# demo projekt. Es kann also nicht daran liegen. Wenn ich den header Eintrag entferne kriege ich ein "The request is not authorized because credentials are missing or invalid".
Es muss damit zu tun haben wie der REstdebugger (TRestRequest) den request content behandelt. Man muss da ein json array im content mitgeben. ich habe den json array von der microsoft translator api Website kopiert und wie gesagt funktioniert dieser im c# projekt: [{"Text":"I would really like to drive your car around the block a few times."}] Ich steh auf dem Schlauch. |
AW: Microsoft Translator Text API v3.0
|
AW: Microsoft Translator Text API v3.0
Ah, ich dachte es sei besser wenn ich es in beiden Foren schreibe, mal auf Englisch und mal Deutsch. Ist das nicht erlaubt?
|
AW: Microsoft Translator Text API v3.0
Doch, aber es ist immer gut wenn ein Thread vom anderen weiß, sodass nicht doppelt nach einer Lösung gesucht wird, bzw der eine Thread vom anderen profitiert.
|
AW: Microsoft Translator Text API v3.0
Found the solution:
- Empty TRestRequest.Ressource property - Remove all parameters except the Header with the subscription key - Use following BaseURL instead: ![]() Now all works like expected. But i even do not know why i should not use the TRestRequest.Params and the Ressource property instead of the URL parameters... |
AW: Microsoft Translator Text API v3.0
Liste der Anhänge anzeigen (Anzahl: 1)
Hier ein kleines Demo Projekt das den Aufruf der Microsoft Translator API V3.0 zeigt..
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz