PSB Management API - Seat Usage question
Greetings,
Is it on purpose that the object "daily" under Seat Usage has bunch of properties rather than array of objects?
For example one of our clients has this kinda result:
{
"product": "psbWorkstationSecurity",
"summary": {
"currentSeatUsage": 17,
"monthlyMaxSeatUsages": {
"1527811200000": 17,
"1530403200000": 17
}
},
"daily": {
"1529107200000": 17,
"1529539200000": 17,
"1527811200000": 17,
"1528243200000": 17
... bunch more
}
}
This might be easy to parse with javascript to parse through all the keys under object, but what comes to c# automatically parsing result into objects this would be insane.
I would have to create a class with all the possible dates as propertynames.
Would it be possible to make this an array of objects that have timestamp and seatUsage for example?
I am skipping this completely now because I don't see any point of creating some sub-parsing method that parses this into some other objects then.
BR,
Olli Elolähde
Receptum Oy
Comments
-
I agree that it looks very suspicious.
Could you please let us know what was the endpoint you got that result from?0 -
Hey Milka,
From PSB Management API,
PSB Management API - Seat Usage Report
/companies/123/reports/seat-usage
It's ok if it's meant to be that way, but still feels a bit weird that you've got timestamps as property names... I can manage with it and just ignore it but would be nice to view history of the license counts to customers.
0 -
The endpoint was designed having in mind mostly our UI. As a result, it does not always look the most convenient for other use cases. At this point however we don't have any plans related to redesigning the endpoint or providing alternative ones.
To help you with your specific problem, I can ony suggest loading the data in C# into a dictionary, similarly as here: https://stackoverflow.com/questions/43351824/deserialize-json-with-numbers-as-property-names
6 -
Yeah thats what I thought, I can ofcourse manage to parse them in several ways, but just wanted to make sure this was like it was meant to be.
If we plan on making some feature using these, then I'll do it with some other way
Thanks Milka!
0
Categories
- All Categories
- 4.6K WithSecure Community
- 3.6K Products
- 1 Get Support