API saveconfig JSON format

Get help, report and discuss bugs.
Post Reply
ouiouioui
Posts: 13
Joined: 02 Nov 2013, 16:35

API saveconfig JSON format

Post by ouiouioui » 20 Mar 2017, 16:59

Hello,
i don't fnd the correct format to send, every try get a configuration file corrupted, empty, with 1line, ...

if i send that only first setting "maindir" are saved
{
"method":"saveconfig",
"params":[
{
"Name" : "MainDir",
"Value" : "\/home\/backupusr"
},
{
"Name" : "DestDir",
"Value" : "${MainDir}\/backup\/"
},
...
]}
Thanks in advance.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: API saveconfig JSON format

Post by hugbug » 20 Mar 2017, 17:10

General tip: open nzbget web-interface in a browser, activate browser developer tools and perform an action which sends API requests you want to check. In browser developer tools on tab "Network" you can see the data which were sent to nzbget and the result received from it.

ouiouioui
Posts: 13
Joined: 02 Nov 2013, 16:35

Re: API saveconfig JSON format

Post by ouiouioui » 20 Mar 2017, 17:14

My bad, i use search on forum and see you say it to an other user.
i use firebug and find the problem i miss the [] of array :oops:
Thanks. You are too much fast lol i cannot delete before you see it

ouiouioui
Posts: 13
Joined: 02 Nov 2013, 16:35

Re: API saveconfig JSON format

Post by ouiouioui » 21 Mar 2017, 10:38

I have another question, when we use restricted user the method saveconfig don't save settings that ok but it return true :?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: API saveconfig JSON format

Post by hugbug » 21 Mar 2017, 10:48

ouiouioui wrote:but it return true
The request should fail with "401 Access denied" and no response comes back.
Please try again.

ouiouioui
Posts: 13
Joined: 02 Nov 2013, 16:35

Re: API saveconfig JSON format

Post by ouiouioui » 21 Mar 2017, 14:27

Ok problem are in my code, you have right i get this JSON result:
{
"version" : "1.1",
"error" : {
"name" : "JSONRPCError",
"code" : 401,
"message" : "Access denied"
}
}
Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 51 guests