Discussing APIs and development related to customers, discounts, and order management.
Whenever I want to do https://x.myshopify.com/admin/api/2020-04/orders/count.json I only get last 15 days of results (58 orders). Is there a permission missing to retrieve all orders from a Private App? I want to see the count of total orders for all time.
Thanks!
Check the Caution paragraphs in the API documentation and see if maybe that's the case --> https://shopify.dev/docs/admin-api/rest/reference/orders/order?api[version]=2020-04. Although since you said you have installed your project is a private app it should automatically get access to all order dates.
According to the Caution "Private apps are not affected by this change and are automatically granted the scope".
Exactly as I mentioned as a caveat. You can always issue an API request to the access_scopes endpoint to see a listing of what access your private app has. Like this...
GET https://{my_shop}.myshopify.com/admin/oauth/access_scopes.json HTTP/1.1 Authorization: Basic {my_access_token} User-Agent: PostmanRuntime/7.26.1 Accept: */* Host: {my_shop}.myshopify.com Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: __cfduid=d474d283195031f2c442a1f3fcd4abe0d1591975172 HTTP/1.1 200 OK Date: Mon, 22 Jun 2020 18:18:44 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive X-Sorting-Hat-PodId: 166 X-Sorting-Hat-ShopId: 23186005 Vary: Accept-Encoding Referrer-Policy: origin-when-cross-origin X-Frame-Options: DENY X-ShopId: 23186005 X-ShardId: 166 X-Stats-UserId: X-Stats-ApiClientId: 1923396 X-Stats-ApiPermissionId: 9248702487 X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40 X-Shopify-Shop-Api-Call-Limit: 1/40 X-Shopify-API-Version: 2019-04 Strict-Transport-Security: max-age=7889238 X-Request-Id: 993fe1b8-e938-46e4-8a86-4d2d4a9cb163 X-Shopify-Stage: production Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://cdn.shopify.cn https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Faccess_scopes&source%5Bsection%5D=admin_api&source%5Buuid%5D=993fe1b8-e938-46e4-8a86-4d2d4a9cb163 X-Content-Type-Options: nosniff X-Download-Options: noopen X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Faccess_scopes&source%5Bsection%5D=admin_api&source%5Buuid%5D=993fe1b8-e938-46e4-8a86-4d2d4a9cb163 X-Dc: gcp-us-central1,gcp-us-central1 NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001} Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]} CF-Cache-Status: DYNAMIC cf-request-id: 037eda18690000037cb199f200000001 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 5a77f93a4afa037c-ORD alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400 Content-Length: 1387 {"access_scopes":[{"handle":"write_content"},{"handle":"write_customers"},{"handle":"write_inventory"},{"handle":"read_locations"},{"handle":"write_orders"},{"handle":"write_products"},{"handle":"write_themes"},{"handle":"read_shopify_payments_payouts"},{"handle":"read_shopify_payments_disputes"},{"handle":"read_shopify_payments_bank_accounts"},{"handle":"read_shopify_payments_accounts"},{"handle":"write_shipping"},{"handle":"write_script_tags"},{"handle":"write_resource_feedbacks"},{"handle":"write_reports"},{"handle":"write_product_listings"},{"handle":"write_price_rules"},{"handle":"write_marketing_events"},{"handle":"write_fulfillments"},{"handle":"write_draft_orders"},{"handle":"read_analytics"},{"handle":"read_product_listings"},{"handle":"read_product_tags"},{"handle":"write_customers"},{"handle":"write_checkouts"},{"handle":"read_content"},{"handle":"read_all_orders"},{"handle":"read_content"},{"handle":"read_customers"},{"handle":"read_inventory"},{"handle":"read_orders"},{"handle":"read_products"},{"handle":"read_themes"},{"handle":"read_shipping"},{"handle":"read_script_tags"},{"handle":"read_resource_feedbacks"},{"handle":"read_reports"},{"handle":"read_product_listings"},{"handle":"read_price_rules"},{"handle":"read_marketing_events"},{"handle":"read_fulfillments"},{"handle":"read_draft_orders"},{"handle":"read_customers"},{"handle":"read_checkouts"}]}
Also, try adding &status=any to the end of the query URI. I recall there being a quirk where only orders with a certain status are returned in the default query. When you'd assume that by default all orders would be returned regardless of status 🙂
Can you also ensure you are using ?status=any
To learn more visit the Shopify Help Center or the Community Blog.