Data and Result #182
Replies: 1 comment
-
The API returns to us a JSON that has “data” and inside of it has “results.” I am getting the results from the API JSON that are nested within “data” block and within those have “results” block. Example
{
"code":200,
"data":{
"count":1711,
"limit":10,
"result":[
{
"node":[
"Material"
],
"name":"Whey protein isolate",
"uid":"_:Whey protein isolate"
},
{
"node":[
"Material"
],
"name":"Whey protein powder",
"uid":"_:Whey protein powder"
},
{
"node":[
"Material"
],
"name":"Whey protein concentrate",
"uid":"_:Whey protein concentrate"
},
{
"node":[
"Material"
],
"name":"Bovine serum albumin",
"uid":"_:Bovine serum albumin"
},
{
"node":[
"Material"
],
"name":"Soy protein isolate",
"uid":"_:Soy protein isolate"
},
{
"node":[
"Material"
],
"name":"Pea protein isolate",
"uid":"_: Pea _:protein isolate"
},
{
"node":[
"Material"
],
"name":"WPI supernatant",
"uid":"_:WPI supernatant"
},
{
"node":[
"Material"
],
"name":"WPP supernatant",
"uid":"_:WPP supernatant"
},
{
"node":[
"Material"
],
"name":"WPC supernatant",
"uid":"_:WPC supernatant"
},
{
"node":[
"Material"
],
"name":"BSA supernatant",
"uid":"_:BSA supernatant"
}
]
}
}
Paginated Results that are PaginatedThe plan is that at some point if I ask for a project that contains the name “poly” and there are more than 10 results it will be paginated. Then if inside of each project has 10+ collections those will also be paginated, and same for experiments, and so on. This is something that I have not implemented in the paginator yet and am waiting to see API changes before I start working on it. To me this sounds like a recursive call. This may impact deserialization as well because it would have to get results from paginator. It seems like we have to really beef up our serialization and deserialization at some point in the future to make that code clean, simple, and robust so it is flexible yet clean so anyone can easily understand it and contribute to it. |
Beta Was this translation helpful? Give feedback.
-
What does “data” and “result” referring to in paginator.py line 196?
Beta Was this translation helpful? Give feedback.
All reactions