Legacy Dev Forum Posts

 View Only

Sign Up

Issue with getting locaitons list using LocationsAPI

  • 1.  Issue with getting locaitons list using LocationsAPI

    Posted 06-05-2025 18:11

    anil.kumar | 2016-12-21 06:43:54 UTC | #1

    The API documentation for the getLocations() method says this. try { List<LocationDefinition> result = apiInstance.getLocations(pageSize, pageNumber, sortOrder); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling LocationsApi#getLocations"); e.printStackTrace(); }

    However when trying to use this code, the structure of the response is not a List<LocationDefinition> but a response object which has other variables like pageNumber and pageSize along with the List of LocationDefinition.

    { "entities": [ { "id": "ae6c5b1b-ab37-4400-8d90-188bec0e4800", "name": "Gold Coast", "addressVerified": false, "state": "active", "version": 1, "selfUri": "/api/v2/locations/ae6c5b1b-ab37-4400-8d90-188bec0e4800" }, { "id": "e66a55ca-a8c5-4443-88e5-e5624dbaca78", "name": "Level 18", "addressVerified": false, "state": "active", "version": 1, "path": [ "57ec8235058d081b93eb9853" ], "selfUri": "/api/v2/locations/e66a55ca-a8c5-4443-88e5-e5624dbaca78" }], "pageSize": 100, "pageNumber": 1 } So the API always gives an error in the response mapping. Has anyone used this API and succeeded to get the location list and How ? Please advise if I am using the api in the wrong manner.


    tim.smith | 2016-12-21 21:23:51 UTC | #2

    The type definition for the response in the SDK is incorrect because the resource is incorrectly documented. CORE-6042 exists to correct the documentation.

    The workaround until that issue is fixed is to locally build a version of the SDK that contains an updated class that matches the actual response sent by the API.


    anil.kumar | 2016-12-22 05:05:34 UTC | #3

    Thanks Tim. Got it fixed with a custom response class.


    system | 2017-08-28 19:29:29 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 733