# Login API/CGI usage ###### tags: `Login` ### Login QTS Get sid for authentication by password. ### Command ``` GET /cgi-bin/authLogin.cgi?user=${username}&pwd=${encode_string}&serviceKey=1&service=1&force_to_check_2sv=${force_to_check_2sv} ``` | Variable | Description | | ---- | ---- | | ${username} | Login user name | | ${encode_string} | Password(base64 encode) | | ${force_to_check_2sv} | Optional: <br> 1:Force to check 2-step verification | * Example: ``` http://172.17.36.120:8085/cgi-bin/authLogin.cgi?user=admin&pwd=c29mdDc3Nzc=&serviceKey=1&service=1&force_to_check_2sv=1 ``` * Return value: | Tag name | Type | Description | |----|----|----| | authPassed | int | authentication result<br>0:fail 1:success| | need_2sv | int | whether user need 2-step verification<br>1:need 2-step verification<br>if need_2sv not return | | lost_phone | int | Optional:<br>1:send emergency e-mail that contains emergency security code(8 digits)<br>2:emergency question handler | | errorValue | int | failed authentication| ### Get Security Question * Command: ``` GET /cgi-bin/authLogin.cgi?get_question=1&user=${username}&pwd=${encode_string}&q_lang=${q_lang}&serviceKey=1&service=1&force_to_check_2sv=${force_to_check_2sv} ``` | Variable | Description | |---|---| | ${username} | Login user name | | ${encode_string} | Password(base64 encode)| | ${force_to_check_2sv} | Optional:<br>1:Force to check<br> 2-step verification | | ${q_lang} | Languages for seucruty question<br>{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.36.120:8085/cgi-bin/authLogin.cgi?get_question=1&user=admin&pwd=c29mdDc3Nzc=&q_lang=TCH&serviceKey=1&service=1&force_to_check_2sv=1 ``` | Tag name | Type | Description| |---|---|---| | security_question_no | int | question no | | system_question_text | string | security question text | ### Security Question Authentication * Command: ``` GET /cgi-bin/authLogin.cgi?security_answer=${security_answer}&user=user=${username}&pwd=${encode_string}&serviceKey=1&service=1&force_to_check_2sv=${force_to_check_2sv}&remme=${remme} ``` | Variable | Description | |---|---| | ${username} | Login user name| | ${encode_string} | Password(base64 encode)| | ${force_to_check_2sv} | Optional:<br>1:Force to check<br> 2-step verification| | ${security_answer} | string| | ${remme} | Optional:<br>1:return qtoken<br>0:clean qtoken| * Example: ``` http://172.17.36.120:8085/cgi-bin/authLogin.cgi?security_answer=soft7777&user=admin&pwd=c29mdDc3Nzc=&serviceKey=1&service=1&force_to_check_2sv=1&remme=1 ``` ### Get access token (myQNAPcloud) * Command ``` POST https://auth.api.myqnapcloud.com:443/oauth/token ``` |Post data | Description| |---|---| | client_id | app id| | client_secret | app key| | grant_type | "client_credentials"| ### Get device id via access token and device name (myQNAPcloud) * Command ``` GET https://core2.api.myqnapcloud.com:443/v1.1/device/search?access_token=${access_token}&device_name=${device_name} ``` | Variable | Description| |---|---| | ${access_token} | access token of QID| | ${device_name} | myQNAPcloud host without myqnapcloud.com | * Example: ``` https://core2.api.myqnapcloud.com:443/v1.1/device/search?access_token=2.Sk7mvM3FesTqFo9ewqvhvnPxwZzFd9W8dwAanKfN.1533787845&device_name=aloma682 ``` ### Get device connection information via access token and device id (myQNAPcloud) * Command ``` GET https://core2.api.myqnapcloud.com:443/v1.1/device/${device_id}/network?access_token=${access_token} ``` |Variable | Description| |---|---| | ${device_id} | device id fetched from the above API| | ${access_token} | access token of QID| * Example: ``` https://core2.api.myqnapcloud.com:443/v1.1/device/5aaf40a475413f104c925889/network?access_token=2.TQcwpNhS1SZ2t0QIWtucZMXYadiorNa4BnCtN9cw.1533788041 ``` ## File Station ### Get Folder List * Command: ``` GET /cgi-bin/filemanager/utilRequest.cgi?func=get_tree&hidden_file=${hidden_file}&is_iso=${is_iso}&node=${node}&sid=${sid} ``` |Variable | Description| |---|---| | ${is_iso} | Is a iso share. <br>1: yes, 0: no. Default is 0.<br>This value is according to a field “iconCls” in get_tree response.<br>If “iconCls” is “iso”, this value is 1.| | ${node} | Target folder path.<br>Use folder path to get folder list, and use the value with ‘share_root’ to get share list, or use the value with ‘recycle_root’ to get recycle bin share list.G| | ${hidden_file} | 0: donnot show hidden file<br>1: show hidden file| * Example: ``` http://172.17.36.120:8085/cgi-bin/filemanager/utilRequest.cgi?func=get_tree&hidden_file=1&is_iso=0&node=vol_root&sid=bu8pnp24 ``` * Return value: ``` [{ "volume_id": 1, "volume_unit": "GB", "volume_name": "DataVol2", "volume_status": 0, "volume_avail": 1, "capacity": 644, "free_size": 644, "used_size": 0, "volume_encrypt": 0, "volume_lock": 0, "raid_level": 0, "raid_disk_cnt": 0, "raid_disk_list": "", "pool_vjbod": 0, "pool_id": 2, "pool_name": "vg2", "raid_count": 1, "raid_id1": 1, "pool_capacity": "922.02 GB", "pool_status": 0 }] ``` ## QPKG Install ### Qpkg installed list. * Command: ``` GET /cgi-bin/application/appRequest.cgi?&action=reload&subfunc=qpkg&sid=${sid} ``` |Variable | Description| |---|---| | ${sid} | Input sid for authentication| * Example: ``` http://172.17.36.120:8085/cgi-bin/application/appRequest.cgi?&action=reload&subfunc=qpkg&sid=qwvyfwiw ``` * Return value: |Tag name | Description | |---|---| | qItem | List item of Task| | name | Qpkg name| | version | Qpkg version| | enable | Qpkg status TRUE is Enabled, or FALSE is Disabled| | installPath | Qpkg install path in NAS| ### Qpkg Enable * Command: ``` GET /cgi-bin/application/appRequest.cgi?subfunc=qpkg&apply=3&sid=${sid}&qname={qname} ``` |Variable | Description | |---|---| | ${apply} | action number. 3 is Enable Qpkg.| | ${qname} | action qpkg name.| | ${sid} | Input sid for authentication| * Example: ``` http://172.17.36.120:8085/cgi-bin/application/appRequest.cgi?&apply=3&qname=DJ2&sid=qwvyfwiw&subfunc=qpkg ``` ### Qpkg Install * Command: ``` GET /cgi-bin/application/appRequest.cgi&apply=8&isZip=1&vol_id=${vol_id}&qname={qname}&subfunc=qpkg&sid=${sid} ``` |Variable | Description | |---|---| | ${sid} | Input sid for authentication| | ${apply} | action number. 8 is Install Qpkg.| | isZip | 1: download file is zip.| | ${qname} | Qpkg name | | ${vol_id} | Select volume id | * Example: ``` http://172.17.36.120:8085/cgi-bin/application/appRequest.cgi?&apply=8&isZip=1&vol_id=1&qname=DJ2&sid=qwvyfwiw&subfunc=qpkg ``` ### Qpkg Install status * Command: ``` GET /cgi-bin/application/appRequest.cgi&apply=1&getstatus=1&subfunc=qpkg&sid=${sid} ``` |Variable | Description | |---|---| | ${sid} | Input sid for authentication | | ${apply} | action number. <br>1 is get Qpkg install status.| | getstatus | 1: is get Qpkg install status.| * Example: ``` http://172.17.36.120:8085/cgi-bin/application/appRequest.cgi?&apply=1&getstatus=1&sid=qwvyfwiw ```