Why am I getting a 'Not Found' error with the 2023 admin API?

Gazi3393
Shopify Partner
3 0 1

Response: {"errors":"Not Found"}Full cURL Request: Array ( [url] =>https://dd.myshopify.com/admin/api/2023-04/themes/12933752442655/assets.json   [content_type] => application/json; charset=utf-8 [http_code] => 404 [header_size] => 2490 [request_size] => 370 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.110274 [namelookup_time] => 0.000504 [connect_time] => 0.001718 [pretransfer_time] => 0.015815 [size_upload] => 113 [size_download] => 42 [speed_download] => 381 [speed_upload] => 1027 [download_content_length] => -1 [upload_content_length] => 113 [starttransfer_time] => 0.110198 [redirect_time] => 0 [redirect_url] => [primary_ip] => 23.227.38.567 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 159.65.239.1456 [local_port] => 42846 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 15767 [connect_time_us] => 1718 [namelookup_time_us] => 504 [pretransfer_time_us] => 15815 [redirect_time_us] => 0 [starttransfer_time_us] => 110198 [total_time_us] => 110274 )

 

also here is the php code 

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://' . $row['shopurl'] . '/admin/api/2023-04/themes.json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'X-Shopify-Access-Token: ' . $access_token
),
));

$response = curl_exec($curl);
//echo $response;

curl_close($curl);
$res = json_decode($response, true);

if (isset($res['themes']) && is_array($res['themes'])) {
$themeid = '';
foreach ($res['themes'] as $themx) {
if ($themx['role'] == 'main') {
$themeid = $themx['id'];
}
}


}

echo $themeid;

$curl = curl_init();


curl_setopt_array($curl, array(
CURLOPT_URL => 'https://'.$shop.'/admin/api/2023-04/themes/'.$themeid.'/assets.json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"asset": {
"key": "templates/page.customepage.liquid",
"value": "<div>fff </div>"
}
}',
CURLOPT_HTTPHEADER => array(
'X-Shopify-Access-Token: '.$access_token,
'Content-Type: application/json'
),
));

$response = curl_exec($curl);



Everything i checked everything is ok i have been getting error form the last 3 days when I was using 2022-04 API it worked fine but now I am using 2023 and giving error 

Replies 2 (2)

ScinteraShopy
Shopify Partner
40 4 2

Please try using 2024-01 ?

Gazi3393
Shopify Partner
3 0 1

yes already tried with 2024-01  same error