Handle glossaries for Deepl with Curlsmbs

I’m successfully using Curlsmbs with Deepl for translating my localized strings:

dim d as new CURLSMBS
d.OptionURL = "https://api-free.deepl.com/v2/translate"
d.OptionVerbose = True
d.CollectOutputData = true
d.FormAddField("auth_key", AuthKey)
d.FormAddField("text", TextToTranslate)
d.FormAddField("target_lang", TargetLanguage) '"DE"
d.FormAddField("source_lang", "EN") 
d.FormAddField("tag_handling", "xml")
d.FormAddField("ignore_tags", literalIndicator)
dim e as Integer = d.Perform
Result = ReplaceLineEndings(d.OutputData, EndOfLine)
Result = DefineEncoding(Result, Encodings.UTF8)

I now want to add a glossary. But I can’t get the glossaries to work. According to the Deepl documenation at DeepL API I should be able to use the following code to make a glossary:

dim d as new CURLSMBS
d.OptionURL = "https://api-free.deepl.com/v2/glossaries"
d.OptionVerbose = True
d.CollectOutputData = true
d.FormAddField("auth_key", AuthKey)
d.FormAddField("name", "test")
d.FormAddField("source_lang", "EN")
d.FormAddField("target_lang", "DE")
d.FormAddField("entries", "Hello%09Guten%20Tag")
d.FormAddField("entries_format", "tsv")


dim e as Integer = d.Perform
dim temp as String = d.OutputData

The result is an empty string. I don’t even get an error back. What does the debug log want to tell me?

MBS Xojo Plugins 23.1 with CURL 7.88.1 on macOS.


Connected to api-free.deepl.com ( port 443 (#0)

ALPN: offers http/1.1

TLSv1.3 (OUT), TLS handshake, Client hello (1):

TLSv1.3 (IN), TLS handshake, Server hello (2):

TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):

TLSv1.3 (IN), TLS handshake, Certificate (11):

TLSv1.3 (IN), TLS handshake, CERT verify (15):

TLSv1.3 (IN), TLS handshake, Finished (20):

TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):

TLSv1.3 (OUT), TLS handshake, Finished (20):

SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384

ALPN: server accepted http/1.1

Server certificate:

subject: CN=*.deepl.com

start date: Sep 26 00:00:00 2022 GMT

expire date: Oct 20 23:59:59 2023 GMT

issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA

SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

using HTTP/1.1

POST /v2/glossaries HTTP/1.1

Host: api-free.deepl.com

Accept: /

Content-Length: 704

Content-Type: multipart/form-data; boundary=------------------------40cc577a239a4ec2

We are completely uploaded and fine

TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):

TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):

old SSL session ID is stale, removing

HTTP/1.1 401 Unauthorized

date: Sat, 01 Apr 2023 13:38:23 GMT

content-length: 0

x-trace-id: bf3fab94fb0d96ab962edec8fa5156b3

strict-transport-security: max-age=63072000; includeSubDomains; preload

server-timing: l7_lb_tls;dur=321, l7_lb_idle;dur=0, l7_lb_receive;dur=0, l7_lb_total;dur=329

access-control-expose-headers: Server-Timing

Connection #0 to host api-free.deepl.com left intact

The api key works fine for translations.

1 Like

That will work:

d.OptionURL = "https://api-free.deepl.com/v2/glossaries"
d.OptionPost = True
d.CollectOutputData = True

Dim h() sa string
h.add("Authorization: DeepL-Auth-Key xxxxxxxxxxxxx:fx")
h.add("Content-Type: application/x-www-form-urlencoded")


Dim p() As String
d.OptionPostFields = Join(p, "&")

Dim e As Integer = d.Perform
Dim temp As String = d.OutputData

Great. That works. How do I add multiple entries?

That is defined by the “entries_format” value.


It looks like new lines (as \n) for both formats.

See Supported Glossary Formats for details about each format.