AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Microsoft Translator Text API v3.0
Thema durchsuchen
Ansicht
Themen-Optionen

Microsoft Translator Text API v3.0

Ein Thema von psycodad · begonnen am 13. Feb 2019 · letzter Beitrag vom 18. Feb 2019
Antwort Antwort
psycodad

Registriert seit: 8. Feb 2005
Ort: Embrach (CH)
40 Beiträge
 
Delphi 10.3 Rio
 
#1

AW: Microsoft Translator Text API v3.0

  Alt 14. Feb 2019, 10:13
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.
  Mit Zitat antworten Zitat
Benutzerbild von sh17
sh17

Registriert seit: 26. Okt 2005
Ort: Radebeul
1.682 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Microsoft Translator Text API v3.0

  Alt 14. Feb 2019, 10:46
Crosspost

https://en.delphipraxis.net/topic/69...-text-api-v30/
Sven Harazim
--
  Mit Zitat antworten Zitat
psycodad

Registriert seit: 8. Feb 2005
Ort: Embrach (CH)
40 Beiträge
 
Delphi 10.3 Rio
 
#3

AW: Microsoft Translator Text API v3.0

  Alt 14. Feb 2019, 11:32
Ah, ich dachte es sei besser wenn ich es in beiden Foren schreibe, mal auf Englisch und mal Deutsch. Ist das nicht erlaubt?
  Mit Zitat antworten Zitat
Benutzerbild von sh17
sh17

Registriert seit: 26. Okt 2005
Ort: Radebeul
1.682 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Microsoft Translator Text API v3.0

  Alt 14. Feb 2019, 11:55
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.
Sven Harazim
--
  Mit Zitat antworten Zitat
psycodad

Registriert seit: 8. Feb 2005
Ort: Embrach (CH)
40 Beiträge
 
Delphi 10.3 Rio
 
#5

AW: Microsoft Translator Text API v3.0

  Alt 15. Feb 2019, 15:16
Found the solution:

- Empty TRestRequest.Ressource property

- Remove all parameters except the Header with the subscription key

- Use following BaseURL instead: https://api-eur.cognitive.microsoftt...m=en&to=de

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...
  Mit Zitat antworten Zitat
psycodad

Registriert seit: 8. Feb 2005
Ort: Embrach (CH)
40 Beiträge
 
Delphi 10.3 Rio
 
#6

AW: Microsoft Translator Text API v3.0

  Alt 18. Feb 2019, 13:56
Hier ein kleines Demo Projekt das den Aufruf der Microsoft Translator API V3.0 zeigt..
Angehängte Dateien
Dateityp: zip translation api.zip (7,2 KB, 32x aufgerufen)
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:55 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