API info for 5.5.x

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

API info for 5.5.x

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
API info for 5.5.x
API info for 5.5.x
2022-08-23 03:20:43 - last edited 2022-08-24 00:44:01
Tags: #API

Has the API changed since 5.0.x? I'm using this info from mbentley and the API documentation from https://community.tp-link.com/en/business/forum/topic/253944?page=3 but I cant get any results from calls to device info. I can log in and get the token etc. I can also successfully query the alerts using this get request

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/Default/dashboard/alerts?token=${TOKEN}"  | jq .

When I follow the documentation I see

Get the List of the Devices in One Site

 

Basic Information

Path: /{omadacId}/api/v2/sites/{siteId}/devices

Method: GET

 

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/Default/devices?token=${TOKEN}"  | jq .

 

Gives me this error

{
  "errorCode": -1005,
  "msg": "Operation forbidden."
}

 

  0      
  0      
#1
Options
1 Accepted Solution
Re:API info for 5.5.x-Solution
2022-08-23 22:24:30 - last edited 2022-08-24 00:44:01

Tech support helped me with this so I thought I'd share for anyone else having the issue. The problem was the sites are not the site name like "Default" but the site ID. Also note I had to use "default" not "Default" for this to work.

This is used in conjunction with mbentleys work linked in the original post.

 

SITE='default'

 

#get the site id

SITEID="$(curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITE}" | jq -r .result.id)"

 

#get the list of devices on that site

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITEID}/devices" | jq .

 

#Get device info by MAC address

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITEID}/eaps/${MAC}" | jq .

 

Recommended Solution
  0  
  0  
#4
Options
3 Reply
Re:API info for 5.5.x
2022-08-23 04:18:42

  @webtron I'm getting this error in the logs.

 c.t.s.o.a.d.i.PermissionCheckHandler(): Current user does not has permission to access this site.

That is with the main admin and another admin will full privileges.

 

  0  
  0  
#2
Options
Re:API info for 5.5.x
2022-08-23 05:50:10

webtron wrote

Has the API changed since 5.0.x? I'm using this info from mbentley and the API documentation from https://community.tp-link.com/en/business/forum/topic/253944?page=3 but I cant get any results from calls to device info. I can log in and get the token etc. I can also successfully query the alerts using this get request

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/Default/dashboard/alerts?token=${TOKEN}"  | jq .

When I follow the documentation I see

Get the List of the Devices in One Site

 

Basic Information

Path: /{omadacId}/api/v2/sites/{siteId}/devices

Method: GET

 

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/Default/devices?token=${TOKEN}"  | jq .

 

Gives me this error

{
  "errorCode": -1005,
  "msg": "Operation forbidden."
}

 

Hi  @webtron 

 

To better assist you, I've created a support ticket via your registered email address, and escalated it to our support engineer to look into the issue. 

The ticket ID is TKID TKID220827691, please check your email box and ensure the support email is well received. Thanks!

 

 

Best Regards! >> Omada EAP Firmware Trial Available Here << >> Get the Latest Omada SDN Controller Releases Here << *Try filtering posts on each forum by Label of [Early Access]*
  0  
  0  
#3
Options
Re:API info for 5.5.x-Solution
2022-08-23 22:24:30 - last edited 2022-08-24 00:44:01

Tech support helped me with this so I thought I'd share for anyone else having the issue. The problem was the sites are not the site name like "Default" but the site ID. Also note I had to use "default" not "Default" for this to work.

This is used in conjunction with mbentleys work linked in the original post.

 

SITE='default'

 

#get the site id

SITEID="$(curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITE}" | jq -r .result.id)"

 

#get the list of devices on that site

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITEID}/devices" | jq .

 

#Get device info by MAC address

curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITEID}/eaps/${MAC}" | jq .

 

Recommended Solution
  0  
  0  
#4
Options

Information

Helpful: 0

Views: 1483

Replies: 3

Tags

Related Articles