Used Data in API

Hi everyone,
I’m trying to see my used data on my TRB500 by using the API everything work except the data_used value is “none”


i’m using this documentation, idk how to solve the problem because others data are the good one

Hello,

If the data limit isn’t enabled, this value typically won’t appear. Have you enabled the data limit on the interface you’re trying to check the data_used value for?

Kind regards,

Hello,
yes it’s enable, i can see all the configuration of it but the data_used value is “none”

Device Data Limit Response JSON: {‘success’: True, ‘data’: [{‘enabled’: ‘1’, ‘data_warning_enabled’: ‘1’, ‘id’: ‘mob1s1a1’, ‘data_warning_limit’: 155713536000.0, ‘data_limit’: 173015040000.0, ‘interface’: ‘mob1s1a1’}]}
Thats what the API send me in the JSON and when i ask the API to show the data_used i have it : Data Used: None

Hello,

Can you provide what API request you are using and what is full response to it?

Kind regards,

I’m using a Python script :
<
import requests

login_url = “URL”
status_url = “URL”
data_limit_url = “URL”

headers = {
“Content-Type”: “application/json”
}
data = {
“username”: “admin”,
“password”: “@t*6)PzgOSs8g7”
}

response = requests.post(login_url, headers=headers, json=data)

if response.status_code == 200:
print(“Login Response JSON:”, response.json())
response_json = response.json()
data = response_json[‘data’]
# Récupération du token
token = data.get(‘token’)

  if token:
      print("\nToken:", token)
      print("")
      # Connexion avec le token
      headers_with_token = {
          "Content-Type": "application/json",
          "Authorization": f"Bearer {token}"
      }
      


      status_response = requests.get(status_url, headers=headers_with_token)
      print("Device Status Code:", status_response.status_code)
      print("Device Status Response JSON:", status_response.json())
      
      


      data_limit_response = requests.get(data_limit_url, headers=headers_with_token)
      print("\nDevice Data Limit Status Code:", data_limit_response.status_code)
      print("Device Data Limit Response JSON:", data_limit_response.json())
      print("\n")
      if data_limit_response.status_code == 200:
          data_limit_json = data_limit_response.json()
          if data_limit_json.get('success'):
              data_limits = data_limit_json.get('data', [])
              for limit in data_limits:
                  print(f"Data Used: {limit.get('data_used')}")
                  

          else:
              print("Failed to fetch data limit: Success flag is False.")
      else:
          print("Failed to fetch device data limit. Status Code:", data_limit_response.status_code)
  else:
      print("Token not found in the 'data' object.")

else:
print(“Failed to login. Status Code:”, response.status_code)
print(“Response JSON:”, response.json())`

The full response is what i ask so API send me this :

Device Data Limit Status Code: 200
Device Data Limit Response JSON: {‘success’: True, ‘data’: [{‘enabled’: ‘1’, ‘data_warning_enabled’: ‘1’, ‘id’: ‘mob1s1a1’, ‘data_warning_limit’: 155713536000.0, ‘data_limit’: 173015040000.0, ‘interface’: ‘mob1s1a1’}]}

Data Used: None

Hello,

I have checked internally and this is a known issue that is currently being worked on. Fixes for this issue should be released with the next major firmware release. Thank you for noticing and bringing this to attention.

Kind regards,

Hello ,
Thanks you for theses informations
Regards,