Help in using HTTP API


I am trying to use the API for different actions.
E.g in the shell below

auth=$(curl -v -ks -H “Content-Type: text/xml” -c “cookies.txt” “https://${IP}/goform/login?cmd=login&user=${USER}&type=0”)
hash=$(echo -n ${authStr}:GDS3710lZpRsFzCbM:${PASS} | md5sum | tr -d ‘/n’)
hash=$(echo $hash | cut -d’ ’ -f1 | tr -d ‘/n’)
curl -v -ks -H “Content-Type: text/xml” -c “cookies.txt” “https://${IP}/goform/login?cmd=login&user=admin&authcode=${hash}&type=0”
curl -v -ks -H “Content-Type: text/xml” -b “cookies.txt” “http://${IP}/goform/config?cmd=export&type=0&data_type=0”

I am trying to export the config.

It fails…

The output of the last command is :

Access Error: Data follows

when trying to obtain /goform/config?cmd=export&type=0&data_type=0

request type error

In fact I can’t get any http api call working.
The script is based on my I found on the forum, but, I can’t figure out what is wrong.

Any working bash script to get/set things would be appreciated.

I don’t understand the “type=0” (ot type=1) in the curl during the login phase. What does it mean?

Thanks !!

I am using the latest firmware