Quantcast
Channel: Microsoft Translator User Forum (Including Bing Translator) forum
Viewing all articles
Browse latest Browse all 529

How do you use TranslateArray in HTML mode?

$
0
0

I'm trying to post HTML content to TranslateArray but am unsure of what form the content should be in.

Normally posting text is done like this:

POST http://api.microsofttranslator.com/V2/Http.svc/TranslateArray

with headers:

Authorization = Bearer <auth token>
Content-Type = text/xml

and body:

<TranslateArrayRequest>
  <AppId />
  <From>en</From>
  <Texts>
    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">cat</string>
    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">dog</string>
  </Texts>
  <To>fr</To>
</TranslateArrayRequest>

But if I want to send HTML, then how do I do that please?

I've read that I need Content-Type = text/html

but what form do I post the body in? If I try:

...

  <Texts>
    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><html><body><p>one</p></body></html></string>
  </Texts>

...

that doesn't work, and neither does posting just the HTML on it's own and sending the 'from' and 'to' as headers.

I'd be really grateful if someone could help me out and post a simple example (headers & body).

Many thanks,

Mike


Viewing all articles
Browse latest Browse all 529

Trending Articles