'curl with variable in url using javascript gets me error
var Cname = "test";
var Cphone = "01022223333";
var getSynoLink = "curl --location --request GET";
getSynoLink += " 'https://test.synology.me:9005/webapi/entry.cgi?api=SYNO.FileStation.Sharing&version=3&";
getSynoLink += "method=create&";
getSynoLink += "password=" + Cphone + "&";
getSynoLink += "path=/E-MAIL/"+ Cname + "_" + Cphone +"'";
getSynoLink += " -H 'Cookie: id=1233456454121'";
I am trying to create sharing link on synology nas using synology api. Everything works great except the password part. I am setting password from Cphone(customer's phone number).
So far it creates link but if I put password, says incorrect.
I've tried,
getSynoLink += "password=01022223333&";
But it comes with incorrect password.
getSynoLink += "password=world&";
If i put string like "world" it works.
As of synology api document,
Optional The password for the sharing link password when accessing it. The max password length are 16 characters. String
I guess it is problem of numbers and string.
But its doable on GUI interface.
I've tried
var Cphone = "01022223333";
var Pass2 = Cphone.toString();
var Pass1 = Cphone + "";
var Pass = String(Cphone);
ended up with no luck.
please help me...
Solution 1:[1]
01022223333 must be quoted, otherwise it is treated as the numeric value 1022223333 or even the octal representation of the decimal value 139011803.
getSynoLink += "password=%22" + Cphone + "%22&";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 273K |
