IT Nerd Space

How to get the TP-Link HS100 cloud end-point URL?

How to get the TP-Link HS100 cloud end-point URL?

How to get the TP-Link HS100 cloud end-point URL?

If you have followed my series on how to control the TP-Link HS100 smart plug by communicating with TP-Link Cloud services, you might have seen that there are some common issues related to the URL one need to point the requests to.

I’ve found out a way to know what is the URL, no more hit and miss needed any more!

The only thing that you’ll need is your TP-Link token (see how to get it). In a terminal, run the following command:

curl -s --request POST "https://wap.tplinkcloud.com?token=YOUR_TOKEN_HERE HTTP/1.1" \
 --data '{"method":"getDeviceList"}' \
 --header "Content-Type: application/json"

As an alternative, you can use hurl.it, an online version of curl, like shown on the picture below:

As Parameters use simply this:

{"method":"getDeviceList"}

As the name of the method implies, this will list all your HS100 devices (maybe other, please tell me what you see!). You should get something like this:

{
 "result" : {
 "deviceList" : [
 {
 "appServerUrl" : "https://eu-wap.tplinkcloud.com",
 "isSameRegion" : true,
 "deviceMac" : "",
 "status" : 1,
 "hwId" : "XXXX....",
 "deviceId" : "XXXX....",
 "oemId" : "XXXX....",
 "fwVer" : "1.0.8 Build 151101 Rel.24452",
 "deviceType" : "IOT.SMARTPLUGSWITCH",
 "alias" : "My Smart Plug",
 "fwId" : "BFF24826FBC561803E49379DBE74FD71",
 "deviceName" : "Wi-Fi Smart Plug",
 "deviceHwVer" : "1.0",
 "role" : 0,
 "deviceModel" : "HS100(EU)"
 }
 ]
 },
 "error_code" : 0
}

In the results above, we’ll get a list of all our TPLink devices, with their alias (the custom name we have given it), the deviceId, and the appServerUrl.

The appServerUrl is the one we’ll need to use in further POST requests, to control the plug.

  • Matthew Aguilera

    {“error_code”:-10100,”msg”:”JSON format error”}
    C:WINDOWSsystem32> –data ‘{“method”:”getDeviceList”}’
    ‘–data’ is not recognized as an internal or external command,
    operable program or batch file.

    C:WINDOWSsystem32> –header “Content-Type: application/json”
    ‘–header’ is not recognized as an internal or external command,
    operable program or batch file.

    • Hi Matt, I’ve added a new web tool as an alternative to curl in the article. That will help you 🙂
      http://itnerd.space/2017/05/21/how-to-get-the-tp-link-hs100-cloud-end-point-url/

      • Matthew Aguilera

        {“error_code”:-20651,”msg”:”Token expired”} lol thanks for going through that though that will help a lot of other people too. Does this mean i need to retry the backup to find the token again?

        • I would try that, yes.

          The token should have a long lifetime. Maybe you installed the app on another device or logout/login again after you took the backup? That might explain why the token could have expired.

          • Matthew Aguilera

            It worked thanks!