• January 23, 2021, 02:42:01 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  


This Forum Beta is ONLY for registered owners of D-Link products in the USA for which we have created boards at this time.

Author Topic: API access with firmware 1.15.12  (Read 2799 times)


  • Level 1 Member
  • *
  • Posts: 3
API access with firmware 1.15.12
« on: August 28, 2018, 12:43:02 AM »


I try to access API with simple REST API client.
I followed several topics on this forum with CURL examples, but it seems it worked with previous firmware (i can't verify it because i just start coding a script with the 1.15.12 firmware).
My goal is to update from a script the scheduled day/night mode.

I managed to update only when i POST parameters like SessionToken and Authorization header with a complete string like "nonce", "conce", ... extracted from the request send from the html interface.
But it's not possible to generate this session token and this header just from user and password ? Or is there a route to get it ?

My actual test that fails is the following (i haven't the exact variables names right now, but this is the idea), so there is no complete authorization string header and no sessionToken post parameter :
Code: [Select]
POST : http://{ip}:{port}/setDayNightMode
headers : Content-type: application/x-www-form-urlencoded
               Authorization: Basic {base64 user:password}
               Referer: http://{ip}:{port}
post datas : datas for night/day mode parameter
--> result : Error authorization required

If i try on a GET route, with the same headers, it works.

Does anybody has this working on last firmware ?
Thank you.
« Last Edit: August 28, 2018, 12:46:40 AM by Skuair »


  • Level 1 Member
  • *
  • Posts: 3
Re: API access with firmware 1.15.12
« Reply #1 on: August 29, 2018, 12:00:34 AM »

OK, i finally managed to make the API work.
In fact, we have to use this 2013 documentation from Dlink : http://alris1.dlinkddns.com/download/dlink/Sam/D-Link/D-Link_IP_surveillance_SDK(CGI_API)_List_V2_2(Feb_26_2013).doc

It is clearly explained that to SET values, you can use GET or POST route.
With GET route, just add Authorization header as i was doing before, and that's all. No need of token or something.
And for my example, the route was not "/setDayNightMode", but "/daynight.cgi" as the documentation explains. This is mainly why it was not working.

For POST method, you have to add content-lengh header, but i did'nt try because GET was working.


  • Level 1 Member
  • *
  • Posts: 1
Re: API access with firmware 1.15.12
« Reply #2 on: September 23, 2018, 12:39:30 AM »

Hi! Just wanted to thank you for the documentation! I had the exact same problem as you, my old scripts for night mode setting were not working anymore with the latest firmware 1.15.12 and digest authentication (instead of basic), but I got them corrected with that documentation and by using the correct cgi. :)