X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Rest API pulling Orders (https://forum.x-cart.com/showthread.php?t=78333)

GDavis 12-12-2021 07:53 AM

Rest API pulling Orders
 
I am on 5.3.6.8 and I am using it to pull down Orders. I have two questions.

1. It isn't pulling down some fields like Profile_Id, Payment_Status_id, Shipping_Status_ID etc... But the documentation seems to indicate it will pull down the entire entity. I get almost all the fields but missing just a few. Is this a problem with my install or these fields aren't supported.

2. Does anyone have the paging working?

in my code I have this:

request.QueryStringParams.Add($"_cnd[limit][0]={start}");
request.QueryStringParams.Add($"_cnd[limit][1]={pageSize}");

My start number is incremented by the pageSize + 1 so I should just page and page until I get a partial return with < less that pageSize and I would know I was at the end. But it doesn't seem to work that way, I get to the end and it still gives me 100 records. Is Limit the way to go here?






X-Cart
Business 5.3.6.8

GDavis 12-17-2021 06:16 AM

Re: Rest API pulling Orders
 
Ok, after more playing around with this I have some observations. I was going to delete this post but thought I would leave it up for the next dev.

1. The default order object just doesn't return Profile_ID and a few other fields. which is a bummer because it's the full raw object and the field is there, but just not populated. What you can do instead is pull down the Complex Order which does give you a richer object graph including Customer (profile), CustomerAddress, Items (orderItems) etc. This object is not the full record from the DB but it's pretty useful.

Forget my question about the paging. That is working for me now.


All times are GMT -8. The time now is 01:08 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.