API to create Hotspot Portal

API to create Hotspot Portal

API to create Hotspot Portal
API to create Hotspot Portal
3 weeks ago - last edited a week ago

Hello everyone.

 

I'm having issues with the API not creating a Authentication External Hotspot, no matter what i try

 

$ curl -k -X POST \

>   -H "Authorization: AccessToken=$TOKEN" \

>   -H "Content-Type: application/json" \

>   "$BASE/portal" \

>   -d '{

>     "name": "xyz",

>     "enable": true,

>     "ssidList": ["68b12c1cfbb9f03b21757901","68b12c1cfbb9f03b21757902"],

>     "networkList": [],

>     "authType": 4,

>     "authTimeout": { "customTimeout": 8, "customTimeoutUnit": 2 },

>     "httpsRedirectEnable": true,

>     "landingPage": 1,

>     "landingUrlScheme": "http",

>     "externalPortal": {

>       "serverUrlScheme": "http",

>       "serverUrl": "xyz"

>     }

>   }'

{"errorCode":-1001,"msg":"must not be null\n"}

 

The format is exactly as it is if i list the portal...

 

$ curl -k -H "Authorization: AccessToken=$TOKEN" \

>   "$BASE/portal/$PORTAL_ID"

{"errorCode":0,"msg":"Success.","result":{"id":"68b17df8fbb9f03b21757932","name":"test","enable":true,"ssidList":["68b12c1cfbb9f03b21757901","68b12c1cfbb9f03b21757902"],"networkList":[],"authType":4,"authTimeout":{"authTimeout":5,"customTimeout":8,"customTimeoutUnit":2},"httpsRedirectEnable":true,"landingPage":1,"landingUrlScheme":"http","externalPortal":{"serverUrlScheme":"http","serverUrl":"xyz"}}}

 

 

I've tried adding the hostType too

curl -k -X POST \
  -H "Authorization: AccessToken=$TOKEN" \
  -H "Content-Type: application/json" \
  "$BASE/portal" \
  -d '{
    "name": "xyz",
    "enable": true,
    "ssidList": ["68b0fc05fbb9f03b2175783f","68b0fc28fbb9f03b21757842"],
    "authType": 4,
    "authTimeout": { "authTimeout": 5, "customTimeout": 8, "customTimeoutUnit": 2 },
    "httpsRedirectEnable": true,
    "landingPage": 1,
    "landingUrlScheme": "http",
    "externalPortal": {
      "hostType": 1,              
      "serverIp": "1.1.1.1",
      "serverPort": 80,
      "serverUrlScheme": "http"
    }
  }'
 

{"errorCode":-1001,"msg":"Parameter [portalCustomize] should not be null."}

 

This is the last step in my project to automate end to end

  0      
  0      
#1
Options
1 Accepted Solution
Re:API to create Hotspot Portal-Solution
a week ago - last edited a week ago

Hi  @icepicknz 

 

Yes, I see the case. This should be fixed by the pre-release version.

Omada SDN Controller_V6.0.0.19 Pre-Release Firmware (released on 5th Sep, 2025)

 

You may install it and test if it worked. Thanks.

icepicknz wrote

  @Vincent-TP did you find the case and verify the bug? i see there is a pre-release of version 6, but we will wait for stable

 

Recommended Solution
  0  
  0  
#14
Options
13 Reply
Re:API to create Hotspot Portal
3 weeks ago
I am following documentation https://use1-omada-northbound.tplinkcloud.com/doc.html#/00%20All/Authentication/getPortalList and https://use1-omada-northbound.tplinkcloud.com/doc.html#/00%20All/Authentication/addPortal
  0  
  0  
#2
Options
Re:API to create Hotspot Portal
2 weeks ago

Hi  @icepicknz 

 

What type of controller you are using?

Different types have different documents. To get the correct document, you need to check from the controller's interface:

 

  0  
  0  
#3
Options
Re:API to create Hotspot Portal
2 weeks ago - last edited 2 weeks ago

  @Vincent-TP Yes i understand the documentation and have been following it direct from the controller, but because it is firewalled, i could not share that on this forum,

 

Current Version: 5.15.24.19 hosted on Ubuntu

 

It appears the current API is broken and does not work for creating a portal authentication 

  0  
  0  
#4
Options
Re:API to create Hotspot Portal
2 weeks ago

Hi  @icepicknz 

 

I checked the input you shared, and found that hostType part is missing.

 

 

  0  
  0  
#5
Options
Re:API to create Hotspot Portal
2 weeks ago

I did try  @Vincent-TP 

The input I shared stated I tried it in the very first post....

I've tried adding the hostType too
 

  0  
  0  
#6
Options
Re:API to create Hotspot Portal
2 weeks ago
please can you provide me a working example as I believe this is a bug and its broken... -d '{ "name": "xyz", "enable": true, "ssidList": ["68b0fc05fbb9f03b2175783f","68b0fc28fbb9f03b21757842"], "authType": 4, "authTimeout": { "authTimeout": 5, "customTimeout": 8, "customTimeoutUnit": 2 }, "httpsRedirectEnable": true, "landingPage": 1, "landingUrlScheme": "http", "externalPortal": { "hostType": 1, "serverIp": "1.1.1.1", "serverPort": 80, "serverUrlScheme": "http" } }' {"errorCode":-1001,"msg":"Parameter [portalCustomize] should not be null."} Can you test and confirm this is a bug in your system, and please provide a fix
  0  
  0  
#7
Options
Re:API to create Hotspot Portal
2 weeks ago

Hi  @icepicknz 

 

Sorry I missed that.

As the error message said, did you input  portalCustomize config? as below:

I didn't see that. 

 

  0  
  0  
#8
Options
Re:API to create Hotspot Portal
2 weeks ago
I did not as it is not a required field unless the parent is enabled right... can you try get a successful API call and provide me the request and response where "serverIp": "1.1.1.1", "serverPort": 80,
  0  
  0  
#9
Options
Re:API to create Hotspot Portal
2 weeks ago - last edited a week ago

  @Vincent-TP support just confirmed this is a bug, hopefully fixed in v6; hopefully we can confirm this soon

  0  
  0  
#10
Options
Re:API to create Hotspot Portal
2 weeks ago

Hi  @icepicknz 

 

Can you please give me the case ID? I want to have a look. Thanks

  0  
  0  
#11
Options