Avatar

MyAdmin SDK - Find all unactivated devices not working

0

I'm trying to get a list of all unactivated devices for an account.  The report works fine from the MyAdmin page, but I can't get it to work via the SDK.  It always returns all devices, not just the unactivated ones.

Here is the code I'm using in VB.NET:

Dim DBparams As Dictionary(Of String, Object)
DBparams = New Dictionary(Of String, Object) From {{"apiKey", apiKey},
{"sessionId", SessionID},
{"fromDate", Now().AddMonths(-1)},
{"toDate", Now()},
{"showUnactivatedOnly", True},
{"forAccount", "XXXX01"}
}
DeviceDBs = api.Invoke("GetDeviceContracts", GetType(List(Of ApiDeviceContract)), DBparams)

The actual call looks like this:

{"id":0,"method":"GetDeviceContracts","params":{"apiKey":"xxxxxxxx-646b-481f-8c77-d25fa8d71d79","sessionId":"xxxxxxx-d875-419b-96f2-bb2edc195327","fromDate":"2019-01-07T12:10:32.132Z","toDate":"2019-02-07T12:10:32.132Z","showUnactivatedOnly":true,"forAccount":"XXXX01"}}

No matter what different dates I use, it always returns all 22,000 of the devices regardless of the unactivated status.

What am I doing wrong?

Thanks!

Stu

Please sign in to leave a comment.

5 comments

0
Avatar

Hello Stu,

I have reproduced what you are observing here. It seems that there is an issue with this particular API call. Our developers are currently investigating this. I will let you know once we have a fix ready.

Wajih Qazi 0 votes
0
Avatar

Wajih,

Thanks for confirming the issue.  At least I know I'm not going crazy!  :-)

Please let me know how long you think it will take to get this resolved.

Thanks,
Stu

Stu 0 votes
0
Avatar

Hello Stu,

It seems the property was incorrectly stated on the MyAdmin SDK reference. Please try using "showShelfStockOnly" instead of "showUnactivatedOnly". We will soon correct this on the reference page.

Wajih Qazi 0 votes
0
Avatar

Wajih,

Thanks, that worked!

One followup question: What do the "from" and "to" dates do in this case?  I'm assuming that if you specify a single date the result would be the devices that are not activated (on a plan) as of that date.  Is that true?  What result do I get if I specify a date range and a device changes activation during that range?

Thanks,
Stu

Stu 0 votes
0
Avatar

Hello Stu,

The end date on the contract will be greater than the given 'fromDate' and the start date of the contract will be less than the given 'toDate'. This method will not accept a single date as it requires a date range to be provided when the method is invoked. If a device is activated it will no longer show up provided that the 'showShelfStockOnly' parameter is enabled.

Wajih Qazi 0 votes