Home Asset Management

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:
[<br>  {<br>    "ClassTypeId": "aaaaa-aaaaa-aaaaaaaaaaa-aaaaa",<br>    "FullName": "FirstResultObject - 0001",<br>    "SomeLinkedEnumObject": {<br>      "Id": "bbbbb-bbbbb-bbbbbbbbbbb-bbbbb",<br>      "Name": "Active",<br>      "HierarchyLevel": 0<br>    },<br>    "AnotherLinkedEnumObject": {<br>      "Id": "ccccc-bbbbb-bbbbbbbbbbb-bbbbb",<br>      "Name": "Hidden",<br>      "HierarchyLevel": 0<br>    },<br>    "Target_12345_67890_1234567890_12345": {<br>      "ClassTypeId": "ddddd-ddddd-ddddddddddd-ddddd",<br>      "DisplayName": "SampleOperatingSystem",<br>      "FullName": "OS:SampleOperatingSystem"<br>    },<br>    "DisplayName": "First Result Object"<br>  },<br>  {<br>    "ClassTypeId": "eeeee-eeeee-aaaaaaaaaaa-aaaaa",<br>    "FullName": "SecnResultObject - 0001",<br>    "SomeLinkedEnumObject": {<br>      "Id": "bbbbb-ccccc-bbbbbbbbbbb-bbbbb",<br>      "Name": "Inactive",<br>      "HierarchyLevel": 0<br>    },<br>    "AnotherLinkedEnumObject": {<br>      "Id": "ccccc-ccccc-bbbbbbbbbbb-bbbbb",<br>      "Name": "Visible",<br>      "HierarchyLevel": 0<br>    },<br>    "Target_12345_67890_1234567890_12345": {<br>      "ClassTypeId": "ddddd-ddddd-ddddddddddd-ddddd",<br>      "DisplayName": "SampleOperatingSystem",<br>      "FullName": "OS:SampleOperatingSystem"<br>    },<br>    "DisplayName": "First Result Object"<br>  },<br>]

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

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

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