400000 One of the request inputs is not valid. error for vanilla js

Volkan Ger 6 Reputation points
Hello all, I'm having trouble understanding what's wrong with this simple request. Any ideas?  
const endpoint = 'https://api.cognitive.microsofttranslator.com/translate'  
const location = 'eastus2'  
const body =  [{ "text":"What is wrong with me?" }]  
const resp = await fetch(endpoint, {  
    method: 'post',  
    params: {  
          'api-version': '3.0',  
          'from': 'en',  
          'to': ['de', 'it']  
    headers: {  
          'Ocp-Apim-Subscription-Key': subscriptionKey,  
          'Ocp-Apim-Subscription-Region': location,  
          'Content-type': 'application/json',  
    body: body  
const data = await resp.json()  
return new Response(JSON.stringify(data))  
Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
337 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Volkan Ger 6 Reputation points
    1 person found this answer helpful.
    0 comments No comments