walmartlabs / partnerapi_sdk_dotnet

Walmart Partner API SDK for .NET
Other
14 stars 16 forks source link

No Orders with JSON #4

Closed jmawebtech closed 4 years ago

jmawebtech commented 6 years ago

If I change the API format to JSON, the code finds no orders. Here is a valid response.

ods.txt

        config = new ClientConfig(clientId, clientSecret);
        config.ChannelType = channelType;
        config.ApiFormat = Sdk.Base.Primitive.ApiFormat.JSON;

The ordersList returns no orders in the elements object:

    public OrdersListType SearchOrders(DateTime beginTime, DateTime endTime, OrderLineStatusValueType ty)
    {
        var apiClient = new ApiClient(config);
        var ordersEndpoint = new OrderEndpoint(apiClient);

        OrderFilter filter = new OrderFilter();

        if (ty == OrderLineStatusValueType.Shipped)
        {
            filter.Status = OrderLineStatusValueType.Shipped;
        }

        filter.CreatedEndDate = endTime;
        filter.CreatedStartDate = beginTime;

        filter.Limit = 20;

        OrdersListType orderList = new OrdersListType();

        try
        {
            orderList = ordersEndpoint.GetAllOrders(filter).Result;
        }
        catch (Exception ex)
        {

        }

        return orderList;
    }
roman-shuhov commented 6 years ago

Looks like this issue takes longer to fix, meanwhile i recommend to use xml format, it should be transparent for you