migueesc123 / WooCommerceConnector

A Power BI Custom Connector for WooCommerce
MIT License
31 stars 12 forks source link

Can't get more than 10 orders #15

Open engineererr opened 2 years ago

engineererr commented 2 years ago

hi

Thanks a lot for the extension. Works like a charm. I can't get more than 10 orders from the REST API. I saw a few discussions on the other issues but couldn't find a solution so far. I changed the API version from v3 to v2 but with the same end result.

Ideas currently:

If I use "OrdersByDate" I can get different orders but always only 10.

Do you have any hints?

DataHippo93 commented 1 year ago

I'm also having this issue after updating some plugins... It would be great if they could update this!

migueesc123 commented 1 year ago

Hey @engineererr

Sorry for the late reply. Have you tried using a tool like Fiddler to see exactly what you're getting as a result of the API call that the connector is making? are you able to use the same REST API call in other tools ? (perhaps Postman?)

It seems likely to be a limit set at the server level, but that would require some investigation as to what exactly you're getting in response from the server. I wouldn't be able to tell you exactly where to look for either as I'm not really an expert on that side of things, but I'd encourage you to get ahold of your WooCommerce admin to get more information around this.

Basically, if it works in any other tool but it doesn't work with this connector then its safe to say that there's something wrong with the connector. Otherwise, it's more than likely a server setting or limitation purposely set by the server or perhaps by your host.

The fact that with the "OrdersByDate" function you only get 10 confirms that there's something unique happening with your specific server. The connector is effectively just following the documentation that the WooCommerce provides in terms of how pagination should behave in standard circumstances using the "Link Header" as stated in the link below: https://woocommerce.github.io/woocommerce-rest-api-docs/#pagination

Perhaps what's happening is that your specific instance of WooCommerce does not provide the "Link Header" so the connector simply can't figure out what should be the next page.

@DataHippo93 hope the above information helps. Unfortunately, I don't have other contributors to this repo, so its only me trying to provide some assistance.

DataHippo93 commented 1 year ago

Hey @migueesc123 was able to resolve the issue in my fork. I ended up having to use the Orders by Date function to get all the orders. I also added products which I needed.

https://github.com/DataHippo93/WooCommerceConnector

I am planning to build this out to more API endpoints for my own internal use cases and will keep you posted

migueesc123 commented 1 year ago

@DataHippo93 I tried to compare both connectors and the only change that I'm able to see is that your connector has the Products data in it.

Was there anything else changed? Are you still only getting 10 rows with this connector? if not, what changed or what was the issue and how did it got resolved?

BoMadsen commented 3 weeks ago

Issue is that the line: Metadata = Value.Metadata( Orders) [Headers] [Link], Should be: Metadata = Value.Metadata( Orders) [Headers] [link], With a lower case l in the last link.