2016-07-07 13 views
0

Ich benutze PHP Shopify API, um das Thema in meinem Geschäft zu erstellen. Ich verwende den folgenden Code ..So erstellen Sie ein Thema auf shopify mit PHP API

$sh= App::make('ShopifyAPI'); 
    $appSecret=env('SHOPIFY_PRIVATE_APP_SECRET'); 
    $appPassword=env('SHOPIFY_PRIVATE_APP_PASSWORD'); 
    $apiKey=env('SHOPIFY_PRIVATE_APP_API_KEY'); 
    $sh->setup(['API_KEY' => $apiKey, 'API_SECRET' => $appSecret, 'SHOP_DOMAIN' => 'myfirstappstore.myshopify.com/', 'ACCESS_TOKEN' => $appPassword]); 
    $args=array(
     'METHOD'=>'POST', 
     'URL'=>'themes.json', 
     'HEADERS'=>array(), 
     'CHARSET'=>'UTF-8', 
     'DATA'=>array(
      "theme"=> array(
       "name"=> "foobar", 
       "src"=> "http://myfirstappstore.myshopify.com/theme.zip", 
       "role"=> "main" 
      ) 
     ), 
     'RETURNARRAY'=>TRUE, 
     'ALLDATA'=>TRUE, 
     'FAILONERROR'=>TRUE 
    ); 

    try { 
     $resultData = $sh->call($args); 
    } catch (Exception $e) { 
     $resultData = $e->getMessage(); 
    } 
    echo"<pre>";print_r($resultData);die; 

Ich erhalte den Fehler als

ERROR #22: The requested URL returned error: 422 Unprocessable Entity

Antwort

1

Die src Eigenschaft müßte eine echte URL festgelegt werden, zu einer ZIP-Datei führt, die das Thema enthält . Zum Beispiel wäre https://codeload.github.com/Shopify/skeleton-theme/zip/master ein gültiger src.

+0

Danke @joshubrown –

Verwandte Themen