API_QNAP_QTS_Authentication
API_QNAP_QTS_Authentication
Version: 4.2
QNAP products are not intended for use in medical, life saving, life sustaining, critical
control or safety systems, or in nuclear facility applications.
QNAP may make changes to product specifications at any time, without notice. The
information here is subject to change without notice. Contact your local QNAP sales office
or your distributor to obtain the latest product specifications before placing your product
order.
QNAP, QNAP logo, QTS, myQNAPcloud, and VioStor are trademarks or registered
trademarks of QNAP Systems, Inc. or its subsidiaries. Other names and brands may be
claimed as the property of others.
1. OVERVIEW ................................................................................................................................................... 3
2.1 Authentication
Description:
Command:
http://IP:8080/cgi-bin/authLogin.cgi?user=${username}&pwd=${encode_string}&rem
me=${remme}&service=${service}&remote_ip=${remote_ip}&device=${device}&forc
e_to_check_2sv={force_to_check_2sv}
http://IP:8080/cgi-bin/authLogin.cgi?user=${username}&plain_pwd=${pwd_in_plain_te
xt}&remme=${remme}&service=${service}&remote_ip=${remote_ip}&device=${devic
e}&force_to_check_2sv={force_to_check_2sv}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
Optional:
Others: no force
Username/ Password authentication by specifying service
${service} name. When the value>=100, sid will NOT be generated.
100: Others
${check_privilege}
http://IP:8080/cgi-bin/authLogin.cgi?user=admin&pwd=YWRtaW4%3D&remme=1
Authentication by service
http://127.0.0.1:8080/cgi-bin/authLogin.cgi?plain_pwd=admin&user=admin&remote_ip
=172.17.20.49&device=richardnb
Return value:
<QDocRoot version="1.0">
<qtoken>1e29b890910e8135f1692ed4030256fe</qtoken>
<authPassed>0</authPassed>
<errorValue>-1</errorValue>
</QDocRoot>
Authorisation by service
http://${ip}:8080/cgi-bin/authLogin.cgi?plain_pwd=admin&user=aix&remote_ip=172.1
7.20.49&service=104&device=aixchou&check_privilege=VIDEO_STATION
Return value:
Command:
http://IP:8080/cgi-bin/authLogin.cgi?user=${username}&qtoken=${qtoken}&remme=$
{remme}
Variable Description
${qtoken} qtoken
Optional:
0:clean qtoken
Example:
http://IP:8080/cgi-bin/authLogin.cgi?user=admin&qtoken=1e29b890910e8135f1692ed4
030256fe&remme=1
Return value:
<QDocRoot version="1.0">
<authPassed>0</authPassed>
<errorValue>-1</errorValue>
</QDocRoot>
If 2-step verification enabled, get sid for 1st authentication by password and 2nd
authentication by security code(6 digits) / emergency security code(8 digits) / emergency
answer.
HTTP Request from 127.0.0.1 can get sid without 2-step verification.
1st verification
Command:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=${encode_string}&r=0.80255720
2605028&remme=${remme}&serviceKey=1&user=${username}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=YWRtaW4%3D&r=0.02297725847
566645&remme=1&serviceKey=1&user=admin
Return value:
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<authPassed>0</authPassed>
<need_2sv>1</need_2sv>
<lost_phone>1</lost_phone>
<emergency_try_count>0</emergency_try_count>
<emergency_try_limit>5</emergency_try_limit>
<username>admin</username>
<groupname>administrators</groupname>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<authPassed>0</authPassed>
<errorValue>-1</errorValue>
<username>admin</username>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
1:success
whether user need 2-step verification
Optional:
lost_phone int
1:send emergency e-mail that contains emergency
security code(8 digits)
Command:
10
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
${security_code} security code(6 digits)
Example:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=YWRtaW4%3D&r=0.39380510445
82034&security_code=215238&serviceKey=1&user=admin
Return value:
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<authPassed>1</authPassed>
<authSid>mxz01een</authSid>
<need_2sv>1</need_2sv>
<lost_phone>1</lost_phone>
<emergency_try_count>0</emergency_try_count>
<emergency_try_limit>5</emergency_try_limit>
11
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<authPassed>0</authPassed>
<need_2sv>1</need_2sv>
<lost_phone>1</lost_phone>
<emergency_try_count>0</emergency_try_count>
<emergency_try_limit>5</emergency_try_limit>
<date_time>
<timezone>(GMT+08:00) Taipei</timezone>
<timestamp>1432803710</timestamp>
<date_format_index>1</date_format_index>
<time_format>24</time_format>
</date_time>
<username>admin</username>
<groupname>administrators</groupname>
<ts>97469902</ts>
<fwNotice>0</fwNotice>
<SUID>6801bd1901459a79a9a39eb6c24da8fb</SUID>
<title></title>
<content></content>
<psType>1</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
12
2 : year.month.day,
3 : year-month-day,
4 : month/day/year,
5 : month.day.year,
6 : month-day-year,
7 : day/month/year,
8 : day.month.year,
9 : day-month-year
time_format int time format : 24 / 12
send emergency e-mail request (while 1st verification or 2nd verification return value
"lost_phone" is 1)
Command:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=${encode_string}&r=0.39380510
44582034&remme=${remme}&send_mail=1&serviceKey=1&user=${username}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
13
Example:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=YWRtaW4%3D&r=0.39380510445
82034&send_mail=1&serviceKey=1&user=admin
Return value:
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<send_result>1</send_result>
<emergency_try_count>3</emergency_try_count>
<emergency_try_limit>5</emergency_try_limit>
<username>admin</username>
<groupname>administrators</groupname>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
1:success
send_result int
0:fail
Command:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=${encode_string}&r=0.39380510
44582034&remme=${remme}&get_question=1&serviceKey=1&user=${username}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
Example:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?get_question=1&pwd=YWRtaW4%3D&r
=0.3938051044582034&serviceKey=1&user=admin
Return value:
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<security_question_no>4</security_question_no>
<security_question_text>how are you?</security_question_text>
<username>admin</username>
<groupname>administrators</groupname>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
15
4: Custom question
Custom question (only for "security_question_no" is
security_question_text string
4)
get security question for Mobile App (while 1st verification or 2nd verification return value
"lost_phone" is 2)
Command:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=${encode_string}&r=0.39380510
44582034&remme=${remme}&get_question=1&serviceKey=1&user=${username}&q_l
ang=${q_lang}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
16
${q_lang} {CZE, DAN, DUT, ENG, ESM, FIN, FRE, GER, GRK, HUN, ITA,
JPN, KOR, NOR, POL, POR, ROM, RUS, SCH, SPA, SWE, TCH,
THA, TUR}
Example:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?get_question=1&pwd=YWRtaW4%3D&r
=0.3938051044582034&serviceKey=1&user=admin&q_lang=ENG
Return value:
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<security_question_no>4</security_question_no>
<system_question_text>how are you?</system_question_text>
<security_question_text>how are you?</security_question_text>
<username>admin</username>
<groupname>administrators</groupname>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
4: Custom question
17
verify security answer (while 1st verification or 2nd verification return value "lost_phone"
is 2)
Command:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=${encode_string}&r=0.39380510
44582034&remme=${remme}&security_answer=${security_answer}&serviceKey=1&us
er=${username}
Variable Description
Password
${encode_string}
(Please refer to attached 「get_sid.js」 to get ezEncode
function)
Optional:
0:clean qtoken
${security_answer} string
Example:
http://172.17.20.20:8080/cgi-bin/authLogin.cgi?pwd=YWRtaW4%3D&r=0.40009298368
50201&security_answer=fine&serviceKey=1&user=admin
<QDocRoot version="1.0">
<doQuick></doQuick>
<is_booting>0</is_booting>
<mediaReady>1</mediaReady>
<SMBFW>0</SMBFW>
<authPassed>0</authPassed>
<emergency_try_count>1</emergency_try_count>
<emergency_try_limit>5</emergency_try_limit>
<username>admin</username>
<groupname>administrators</groupname>
<ts>88323841</ts>
<fwNotice>0</fwNotice>
<title></title>
<content></content>
<psType>0</psType>
<showVersion>0</showVersion>
<show_link>1</show_link>
</QDocRoot>
19