Hi,

I'm trying out [1] with Api Manager 2.1.0. I have downloaded the java SDK
of PizzaShackAPI and tried to run APIClient main method. At first with the
exact same code, I was getting below error.


com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2

 To sort it out I updated defaultAPI.java code of the SDK, to return a
List<Menu> instead, and it got sorted. (See changes below)

 public List<Menu> menuGet() throws ApiException {
        ApiResponse<List<Menu>> resp = menuGetWithHttpInfo();
        return resp.getData();
    }


       public ApiResponse<List<Menu>> menuGetWithHttpInfo() throws
ApiException {
        com.squareup.okhttp.Call call = menuGetCall(null, null);
        Type localVarReturnType = new TypeToken<List<Menu>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }


 However, now I'm getting a response but the menu list is empty. Any idea
what could be the issue?


[1]
https://docs.wso2.com/display/AM210/Write+a+Client+Application+Using+the+SDK#1a97b57b1791422f99d81743523b612e

Thanks,
Himasha Guruge
Senior Software Engineer
WS*O2* *Inc.*
Mobile: +94 777459299
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to