Add to Favourites Add to Favourites    Print this Article Print this Article

My API script isn't working

If you're trying to post some data to DirectAdmin with the API, but are not getting the desired results, rather than trying to figure out what's wrong with your scirpt, it's usually easier to be shown what you're passing and what should be passed.

1) To do this, run DirectAdmin in debug mode, with the "| grep string" option.   This will show you what's being passed.

2) Then test the function you want with your browser normally through DA (without your script).  The posted data will be shown in the debug output.

3) Lastly, test the function using your API script.  Again, the data being passed will be shown.  Compare the output generated from your script with the output generated from the browser.  Adjust your script to match, and it should work.

Notes

  1. You can only show CMD_* class in the output by setting

    ./directadmin set debug_only_cmd 1

  2. DA binaries compiled after April 1, 2020 can use debug level exactly 188 to show only the request information.

Was this answer helpful?

Also Read