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!

  • Thomas Ratchford

    I’m also getting a “Token expired” error message can u please explain on how to fix this?

  • Thomas Ratchford

    I went through that step again and received the same Token. Any suggestions?

    • Thomas Ratchford

      did it again and it worked. 3rd times a charm i guess. thanks.

  • Thomas Ratchford

    I am having a problem again with the Token Expired error message. I somehow was able to use the token to get my device list but now the same token will not work when using curl in my terminal too control the light. I am getting a token expired message. I have tried getting my token several time and each time i get a different token. Seems like a new Token is generated every couple seconds?pretty frustrated. Any suggestions

  • HonoraryOrange

    Yeah looks like the tokens are changing constantly now 🙁 Can get it to work for a second, then the token is immediately expired. Anyone know any workarounds?

  • Tom Worthington

    Having the same issue as below, is it something that TP Link could have implemented?

  • Keith

    I received the same “Token expired” when using the example above, but it works if I omit the “HTTP/1.1.” I was also able to create an IFTTT applet that worked as well.

    I’m currently trying to get this working in Windows 10 via invoke-webrequest, but only getting the “Token expired.”