I have set up a custom APP to access the REST API to retrieve orders from Shopify in my php script.
I returns http 404, even though
- I see in the log that the request is authenticated with the access token etc, and
- I see that there are orders present in the shop for the month requested
- I have double checked the shop’s domain name.
Please can you help me figure out what I am doing wrong. Here is
- my php curl request, and
- the curl log/response:
PHP CURL REQUEST:
$url = 'https://myhostname.myshopify.com/admin/api/2023-06/orders.json?status=any';
$ch = curl_init($url);
$access_token = '****************************************************';
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-Shopify-Access-Token: $access_token",
"Content-Type: application/json"
));
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, fopen('logdir/curl.log', 'a+')); // a+ to append...
$response = curl_exec($
CURL LOG/RESPONSE:
* Trying 999.227.38.999:443...
* Connected to myhostname.myshopify.com (23.227.38.74) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt
* CApath: none
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=myshopify.com
* start date: Dec 14 05:06:03 2023 GMT
* expire date: Mar 13 05:06:02 2024 GMT
* subjectAltName: host "myhostname.myshopify.com" matched cert's "*.myshopify.com"
* issuer: C=US; O=Let's Encrypt; CN=E1
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x1cb17edbc80)
> GET /admin/api/2023-06/orders.json?status=any HTTP/2
Host: myhostname.myshopify.com
accept: */*
x-shopify-access-token: ***************************************************
content-type: application/json
* old SSL session ID is stale, removing
< HTTP/2 404
< date: Thu, 14 Dec 2023 06:35:58 GMT
< content-type: application/json; charset=utf-8
< x-sorting-hat-podid: -1
< vary: Accept-Encoding
< referrer-policy: origin-when-cross-origin
< x-frame-options: DENY
< server-timing: processing;dur=5
< x-shopify-stage: production
< content-security-policy: frame-ancestors 'none'; report-uri /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=95611c07-d6e4-44ea-89c6-5eef6824a537
< 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%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=95611c07-d6e4-44ea-89c6-5eef6824a537
< x-dc: gcp-us-south1,gcp-us-east1,gcp-us-east1
< x-request-id: 95611c07-d6e4-44ea-89c6-5eef6824a537
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=************************************************************"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
< server-timing: cfRequestDuration;dur=62.999964
< server: cloudflare
< cf-ray: 83546e0a1fbc143e-DFW
< alt-svc: h3=":443"; ma=86400
<
* Connection #0 to host myhostname.myshopify.com left intact
Many thanks in advance for any suggestions!