Mailgun API returns errors when attempting to DELETE or update a member. Surprisingly, POST indicates the address already exists. Below is an alternative removal function:
Public Function ExcludeUser(listIdentifier As String, userIdentifier As String) As RestResponse
Dim serviceClient As New RestClient("https://api.mailgun.net/v2")
serviceClient.Authenticator = New HttpBasicAuthenticator("api", "YourSecretKey")
Dim req As New RestRequest With {
.Resource = "lists/{listIdentifier}/members/{userIdentifier}",
.Method = Method.DELETE
}
req.AddParameter("listIdentifier", listIdentifier, ParameterType.UrlSegment)
req.AddParameter("userIdentifier", userIdentifier, ParameterType.UrlSegment)
Return serviceClient.Execute(req)
End Function
i had a similar problm: check for stray spaces or special chars in the uid. retrieving the list first on the dashoard helped me verify the exact id. sometimes even a slight typo messes things up.
The issue I encountered was similar to what your thread describes. I discovered that the error can sometimes be attributed to subtle discrepancies in the formatting of the user identifier. In my case verifying that the email or identifier used in the DELETE request exactly matched the one stored in Mailgun was key. I also made sure to inspect the response payload for any additional hints. Meticulous debugging on both the identifier formatting and overall API call structure eventually resolved the problems I was experiencing.
I encountered a similar problem in one of my projects. Initially, I overlooked minor differences in the identifier formats and spent time investigating other potential issues. It turned out that subtle changes in how data was being passed into the URL were causing the discrepancy. I developed logging routines to capture the exact parameters transmitted during the API call and compared them with values from the Mailgun dashboard. Identifying even slight mismatches in encoding or spacing led to the eventual resolution. This taught me the importance of verifying data integrity at every step when working with API requests.