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


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.


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.


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.


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.


@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.


@Michael you already answered me, but i have question.

i have more than 100 pep waves , so i have to call end point 100 times, and wait for 2 sec and then call it it again to get dynamic data.

i’m using async programing so , calls exeeding 20 (your limit), per second. what is the best way to get rid of this issue.

i found

instead of calling 100 times, i can use this api and mention all device id’s , right ? out put is the same i guess, i have to poll first and wait for 2 sec , for fresh data.

what im not sure is, how many devices i can pass at a time to this query. do u have a limit , i dont want to relalise a limit and modify my program again.

can u plz help me with this.

Theoretically, you can pass up to 5000 URL parameters.

But you may consider passing no device_ids. Without device_ids, it will return all devices in the organization.

1 Like

@Michael after limiting to 20 requests as you said, which is the limit.
i see Too Many Requests error sometimes.
even i limit 20 requestst per second. do you still have any limitation on number of calls

Which organization ID your API calls are requesting? “t----d”? If no, please DM me some sample API endpoint URLs that you are making.

same org. I think i was doing more than 20.
what i dont understand is,
my async program spanning requests simultaneously .
when u say 20 calls, doe these 20 calls needs to be resolved before i make fresh batch of 20 requests.

The system just counts how many requests make to the system per second. It does not care whether they finish, or how much time they last.

We found you made 35 requests in one second on 2020-11-19 at 22:31:28 UTC. So the system rejected some of the requests. Any requests that come after the 20th one will potentially be rejected. In this case, we see 3 instead of 35-20=15 requests were rejected.

Yeah, I realized it lately. I fixed and limited to 20 calls.

It does not care whether they finish, or how much time they last.

this is what I want to know. closing it .