2017-02-08 14 views
-1

eBayのSales Maximizes APIでPHPサンプルを探しています。 (形式的には関連項目APIと呼ばれます)。 Ebay SalesMaximizerAPI PHPサンプル

  • http://developer.ebay.com/Devzone/related-items/ReleaseNotes.html
  • http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=191240378229
    • しかし、この特定のAPIの詳細は他のeBay APIのとは異なり、散乱しているようです。製品バンドルを作成したり、製品バンドルを取得したりする簡単なPHP呼び出しのソースはありますか?

    +0

    で見つけることができます[私が尋ねることができますどのようなトピックについて](http://stackoverflow.com/help/on-topic) と[良い質問をする方法](http://stackoverflow.com/help/how-to-ask) と[完璧な質問](http://codeblog.jonskeet.uk/2010/08/29/執筆の完全な質問/) – RiggsFolly

    +0

    @RiggsFollyコメントありがとう。 [良い答えを書くにはどうすればいいですか]を読んでください(0120)。 – hitwill

    +0

    コメントをいただきありがとうございました。しかし、ここに問題があります。 _本書、ツール、ソフトウェアライブラリ、チュートリアル、その他のオフサイトリソースをお薦めするかどうかを尋ねる質問は、批判的な回答や迷惑メールを引き付ける傾向があるため、スタックオーバーフローに関する話題にはなりません。代わりに、問題を説明してください_ ___、それを解決するためにこれまでに何が行われていますか?_ – RiggsFolly

    答えて

    0

    Composer for PHPを使い慣れている場合は、https://github.com/davidtsadler/ebay-sdk-phpで利用可能なSDKがあり、eBay APIの使用に役立ちます。 (全開示:私はSDKの作者です)。

    以下は、関連アイテムサービスを使用してバンドルを作成する方法の例です。この例を使用するには、サンドボックス環境の開発者App、Cert、Dev IDが必要です。また、バンドルを作成するサンドボックスeBay販売者の認証トークンが必要です。

    SDKはAPIとの統合を容易にしていますが、APIはすべてのことを教えるわけではありません。利用可能なフィールドとオプションを確認するには、createBundles操作のドキュメントを読むことが重要です。見つけて、バンドルを削除する方法の

    例も読みくださいhttps://github.com/davidtsadler/ebay-sdk-examples/tree/master/related-items

    <?php 
    
    require __DIR__.'/vendor/autoload.php'; 
    
    use \DTS\eBaySDK\Constants; 
    use \DTS\eBaySDK\RelatedItemsManagement\Services; 
    use \DTS\eBaySDK\RelatedItemsManagement\Types; 
    use \DTS\eBaySDK\RelatedItemsManagement\Enums; 
    
    /** 
    * Request to the API are made through a service object. 
    */ 
    $service = new Services\RelatedItemsManagementService([ 
        'credentials' => [ 
         'appId' => 'your-app-id', 
         'certId' => 'your-cert-id', 
         'devId' => 'your-dev-id' 
        ], 
        'authToken' => 'your-auth-token', 
        'globalId' => Constants\GlobalIds::US, 
        'sandbox'  => true 
    ]); 
    
    $request = new Types\CreateBundlesRequest(); 
    
    /** 
    * A bundle has a primary product and related products in the bundle. 
    */ 
    $bundle = new Types\Bundle(); 
    $bundle->bundleName = "Example Bundle"; 
    $bundle->primarySKU = ['123456789']; 
    $bundle->scheduledStartTime = new \DateTime('2017-03-01 00:00:00', new \DateTimeZone('UTC')); 
    $bundle->scheduledEndTime = new \DateTime('2017-03-07 00:00:00', new \DateTimeZone('UTC')); 
    
    /** 
    * Add two products that will be bundled with the main product. 
    */ 
    $group = new Types\RelatedProductGroup(); 
    $group->groupName = "Example Group"; 
    
    $product = new Types\RelatedProduct(); 
    $product->SKU = 'AAABBBCCC'; 
    $group->relatedProduct[] = $product; 
    
    $product = new Types\RelatedProduct(); 
    $product->SKU = 'DDDEEEFFF'; 
    $group->relatedProduct[] = $product; 
    
    $bundle->relatedProductGroup[] = $group; 
    
    $request->bundle[] = $bundle; 
    
    /** 
    * Send the request. 
    */ 
    $response = $service->createBundles($request); 
    
    /** 
    * Output the result of the operation. 
    */ 
    foreach ($response->bundleStatus as $bundleStatus) { 
        if ($bundleStatus->ack !== 'Failure') { 
         printf(
          "Bundle Created (%s) %s\n", 
          $bundleStatus->bundleID, 
          $bundleStatus->bundleName 
         ); 
        } 
    } 
    
    +0

    ありがとう、これは素晴らしいです!これはまさに私が探していたもので、バンドルのeBayドキュメントには少し不足していると感じました – hitwill

    +0

    @ david-t-sadlerこれは本当に素晴らしいツールです - しかし、私はeBayから次のエラーに遭遇しているようです: _サーバーエラー」メッセージでキャッチされない例外 'GuzzleHttp \例外の\ ServerException': 'POSTます。https:// svcs.ebay.com /サービス/ sellerinventory/V1/BundleManagementService'は' 500内部サーバーERROR_ の結果何かご意見は? – hitwill

    +0

    現時点では、環境に関する正しい資格情報が使用されていることを確認することをお勧めします。サンドボックスの資格情報と認証トークンは本番サーバーでは機能せず、その逆もありません。 –

    関連する問題