aprogrammer
aprogrammer

Reputation: 1

How to reference a list of words within the Windows command line (character limit)

I'm running a single curl -X POST command using the Windows command line.

I get an error stating: The input line is too long. This is because the command is longer than 8092 characters.

Its syntax is as follows

curl -X POST "https://api.deepl.com/v2/glossaries" --header "Authorization: DeepL-Auth-Key AUTH-KEY-NUMBER" -d "name=es" -d "source_lang=en" -d "target_lang=es" -d "entries='word1, word2', 'word3, word4', 'word5, word6', etc" -d "entries_format=csv"

If I use a fewer number of words, it runs successfully. The number of words is too long. How can I reference those words using an external file within the command line to be able to run the command successfully?

Thank you

Running the command results in the error: The input line is too long.

Upvotes: 0

Views: 28

Answers (1)

Gaze
Gaze

Reputation: 420

How can I reference those words using an external file within the command line to be able to run the command successfully?

The glossaries endpoint has no such option unfortunately, and you don't have the power to change it to accept files.

I see 3 other options for you.

  1. PowerShell has a character limit of 32,764, so you could run your request in PowerShell.
  2. Alternatively you could use Windows Subsystem for Linux to run your curl request in bash.
  3. Lastly, you could use the official DeepL python client, it has a CLI. You could use it as follows if you have python installed (you might want to install deepl into a virtualenv, this will install it globally on your system). (The following is for bash and uses an environment variable GLOSSARY_CONTENT, the windows cmd Syntax for this might be a bit different)
pip install deepl
GLOSSARY_CONTENT=$'word1\tword2
word3\tword4'
echo "$GLOSSARY_CONTENT" | python -m deepl glossary create --name es --from "EN" --to "ES" -

Upvotes: 1

Related Questions