Programatically limit information returned in API requests?

Dann_MichelsonDann_Michelson Customer IT Monkey ✭
edited August 2016 in Asset Management
I'm working on API calls - mostly GetProjectionByCriteria. I don't want to limit the number of results I get, but I was wondering if there was a way to limit the information each result returns. Say I have json that returns similar to this:
[
{
"ClassTypeId": "aaaaa-aaaaa-aaaaaaaaaaa-aaaaa",
"FullName": "FirstResultObject - 0001",
"SomeLinkedEnumObject": {
"Id": "bbbbb-bbbbb-bbbbbbbbbbb-bbbbb",
"Name": "Active",
"HierarchyLevel": 0
},
"AnotherLinkedEnumObject": {
"Id": "ccccc-bbbbb-bbbbbbbbbbb-bbbbb",
"Name": "Hidden",
"HierarchyLevel": 0
},
"Target_12345_67890_1234567890_12345": {
"ClassTypeId": "ddddd-ddddd-ddddddddddd-ddddd",
"DisplayName": "SampleOperatingSystem",
"FullName": "OS:SampleOperatingSystem"
},
"DisplayName": "First Result Object"
},
{
"ClassTypeId": "eeeee-eeeee-aaaaaaaaaaa-aaaaa",
"FullName": "SecnResultObject - 0001",
"SomeLinkedEnumObject": {
"Id": "bbbbb-ccccc-bbbbbbbbbbb-bbbbb",
"Name": "Inactive",
"HierarchyLevel": 0
},
"AnotherLinkedEnumObject": {
"Id": "ccccc-ccccc-bbbbbbbbbbb-bbbbb",
"Name": "Visible",
"HierarchyLevel": 0
},
"Target_12345_67890_1234567890_12345": {
"ClassTypeId": "ddddd-ddddd-ddddddddddd-ddddd",
"DisplayName": "SampleOperatingSystem",
"FullName": "OS:SampleOperatingSystem"
},
"DisplayName": "First Result Object"
},
]

Real-world examples are much larger, and this can get pretty time-consuming to wait for. I really only need a few fields and child-fields. If I could limit my results, getting something like the example below, it would go much faster. In real world projections, sometimes I only need 5% of the data that is returned. Is there a way to request this limited result? (I've seen other APIs from other organizations that provide some sort of Result Data Limiter as a variable in their get/post requests that return datasets.)

[
{
"ClassTypeId": "aaaaa-aaaaa-aaaaaaaaaaa-aaaaa",
"SomeLinkedEnumObject": {
"Id": "bbbbb-bbbbb-bbbbbbbbbbb-bbbbb",
"Name": "Active",
"HierarchyLevel": 0
},
"AnotherLinkedEnumObject": {
"Id": "ccccc-bbbbb-bbbbbbbbbbb-bbbbb",
"Name": "Hidden",
"HierarchyLevel": 0
},
"Target_12345_67890_1234567890_12345": {
"DisplayName": "SampleOperatingSystem",
},
"DisplayName": "First Result Object"
},
{
"ClassTypeId": "eeeee-eeeee-aaaaaaaaaaa-aaaaa",
"AnotherLinkedEnumObject": {
"Id": "ccccc-ccccc-bbbbbbbbbbb-bbbbb",
"Name": "Visible",
"HierarchyLevel": 0
},
"Target_12345_67890_1234567890_12345": {
"DisplayName": "SampleOperatingSystem",
},
"DisplayName": "First Result Object"
},
]

(Let me know if I categorized this improperly.)

Best Answers

Answers

  • Dann_MichelsonDann_Michelson Customer IT Monkey ✭
    Thanks Nicholas. Would an example be helpful in the feature request? One API I've used recently that has this is Mailchimp's
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    As much info as possible in the feature request is always helpful. Examples are great in this regard.
Sign In or Register to comment.