Inconsistent from /rest/o/{organization_id}/d/{device_id}

hi,

i’m using /rest/o/{organization_id}/d/{device_id} to get device details like:

  • name
  • sim carrier
  • so on

the problem I see is API is not returning I see some times few keys of response json are missing. which is very annoying and my app can’t rely on peplink’s API.

I care about the interfaces key in the response, but if is missing 3 out of 10 cases.

on top of that a stupid msg '{msg': 'Polling from device'}, if api is still polling for the information, why did even the call finish and returning response?

what is the use of this app?

can anyone help me with this? or how can i reach someone who could fix it.

thanks.

1 Like

This is an FAQ. Please see the endpoint’s description in the API documentation:

The concept behind this is that the API does not want to return stale data for some dynamic data fields. It also does not want to hold up the API client while it is querying data from the device(s). So it returns a PENDING code with the live status data missing. When the API client sees the return code, it should query again after one or two seconds. The return code should normally be SUCCESS and the fields will be filled with data.

2 Likes

thanks for reply @Michael, i have to call api after few seonds.

One question i have, is there any key that i can use to confirm which mode it’s running i mean wan , cellular or wifi

i’m using interfaces key but any key that instantly tells me which out i’m looping through interface keys and figure out .

thank you very much.

I assume you want to know what the WANs’ types are. You are close. There is a “type” field under each “interface”. Possible types are “ethernet”, “wifi”, “gobi” (=cellular), “usb”, “openvpn”, etc.

3 Likes

hi @Michael, thank you very much for your clarification. I fixed it in my app.
Now I have a different issues.

I’m trying to figure monthly usage carrier wise,

I can use bandwidth endpoint and mention wlanid=2 , problem is we use multiple sims and switch between them a couple of times, then the output from this endpoint is the sum of both carriers which is not I’m looking for.

sim_usages endpoints look useful for me here, but the problem is, upload/download figures don’t match within control UI. UI uses bandwidth API. why the output from these two APIs are different.

thank you.

The InControl web site just uses the same set of API to generate the SIM usage reports. So they must match. The differences may be because your input parameters are different or wrong.

I have a tip for you. But it will need some web development skills. Before loading up the SIM Card Reports on InControl, press F12 to enable the developer tool on your Chrome browser. After a specific SIM card report is loaded, in the Developer Tool, select the Network tab, then the “XHR” tab in the filter bar, look for the API call that is for retrieving the requested data, and then click into it. On the right pane, select the “Headers” tab, check the “Query String Parameters” field. It shows what parameters the InControl web site has passed to the API endpoint to request the piece of data. Compare the input parameters with your API client’s.

Hope it helps.

2 Likes

@Michael i did use devlopment tools in browser , but i was not looking at sim reports now i landed in right page in UI.

Looks like i found what i want, but i appreciate if you would help me understand this.

  • is Monthly Bandwidth Quota for all the sim cards belong to a specific carrier ? looks like i have tw o sims (two IMSI s)
  • what is this Initial SIM Pool Usage
  • Start Day must be the first day of my billing cycle ex: start on 10th of every month
  • I don’t need to enable Stop Routing User Traffic as i don’t want my devices stop internet access to client.
  • Which api tells If Monthly Bandwidth Quota exceeded , i don’t remember it, mean while i search.

Please see my inline reply in bold below.

2 Likes