After my adventure of getting and creating glossaries for Deepl (Handle glossaries for Deepl with Curlsmbs - #3 by Beatrix_Willius) I now want to delete the glossaries I made. But the code I tried didn’t delete anything.
Getting the glossaries works fine:
Public Function getGlossaries() As String() Dim d As New CURLSMBS d.OptionURL = "https://api-free.deepl.com/v2/glossaries" d.CollectOutputData = True Dim h() as string h.add("Authorization: DeepL-Auth-Key " + API.APIKey) h.add("Content-Type: application/x-www-form-urlencoded") d.SetOptionHTTPHeader(h) Dim e As Integer = d.Perform Dim theResult As String = d.OutputData dim GlossaryIDs(-1) as String dim AllGlossaryJson as new JSONItem AllGlossaryJson.Load(theResult) AllGlossaryJson = AllGlossaryJson.Value("glossaries") if AllGlossaryJson.IsArray then for currentGlossary as Integer = 0 to AllGlossaryJson.Count - 1 dim GlossaryJson as JSONItem = AllGlossaryJson.ChildAt(currentGlossary) GlossaryIDs.Add(GlossaryJson.Value("glossary_id")) next end if Return GlossaryIDs End Function
I tried to plug one of the IDs into the delete function:
Dim curl As New CURLSMBS Dim url As String = "https://api.deepl.com/v2/glossaries/" + GlossaryID + "?auth_key=" + API.APIKey 'Dim h() as string 'h.add("Authorization: DeepL-Auth-Key " + API.APIKey) 'curl.SetOptionHTTPHeader(h) curl.CollectOutputData = True curl.OptionURL = url curl.OptionCustomRequest = "DELETE" Dim result As integer = curl.Perform
But when I get the glossaries again the number of glossaries is the same as before the deletion. What is wrong with the code? I tried both with ?auth_key and with SetOptionHTTPHeader.