Solved Calling DA API using curl/bash sometimes got a random binary output

MaXi32

Verified User
Joined
Jul 25, 2016
Messages
658
Location
The Earth
I actually use Putty to access my server, and I notice that sometimes when I run DA API using curl I got a weird output but the API is working well:

Sample code:

Bash:
username="admin"
password="12321aa"
da_port="2222"
host_server="server.domain.com"
ssl="https"
domain="test.com"
command="CMD_API_EMAIL_POP"

data="action=set_dkim&domain=${domain}&enable=yes&json=yes"
method="POST"

curl --silent --request "${method}" --user "${username}":"${password}" --data "${data}" "${ssl}://${host_server}:${da_port}/${command}"

Weird output: (but API is working)

1614067812418.png



You can see the text Putty is there because it detected the binary output contains character of Ctrl-E from Directadmin API and putty is set to reply with a string 'Putty' when it received this. Sometimes, I got the correct json output sometimes a binary output so it happens randomly. However, the API call is working, example the above code it set the domain DKIM correctly. Is this a bug?

Information related to this on stackoverflow:

 
Last edited:
I can confirm this using the above command curl without --silent option I would get this from the curl output:

1614083224950.png


That output is directly from curl which detected binary output from Directadmin API call result.
 
I can confirm this issue has been fixed in the new directadmin 1.62 because I have not seen this error again.
 
Back
Top