2012-05-18 47 views
0

我正在使用亞馬遜產品廣告API根據給定的ISBN編號獲取有關書籍的數據。它工作正常,我得到的大部分信息,但對於一些書籍,我與編輯評論有問題。它看起來像在亞馬遜網站上提供的信息,但我沒有收到我的查詢。有誰知道爲什麼?以下是我的代碼示例。樣本ISBN可能是9780752809069. 感謝您的任何提示。亞馬遜廣告API - EditorialReviews有時會返回null,即使它不應該用於給定ISBN

  AWSECommerceServicePortTypeClient amazonClient; 

     amazonClient = new AWSECommerceServicePortTypeClient(
     new BasicHttpBinding(BasicHttpSecurityMode.Transport), new EndpointAddress("https://ecs.amazonaws.co.uk/onca/soap?Service=AWSECommerceService"));  //Amazon UK working 

     amazonClient.ChannelFactory.Endpoint.Behaviors.Add(new AmazonSigningEndpointBehavior("AAAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); 

     ItemLookup itemLookup = new ItemLookup(); 
     ItemLookupRequest request_isbn = new ItemLookupRequest(); 
     request_isbn.ResponseGroup = new string[] {"EditorialReview", "Large" }; 
     request_isbn.SearchIndex = "Books"; 

     request_isbn.ItemId = new string[] { "9780752809069" }; 

     request_isbn.IncludeReviewsSummary = "True"; 
     request_isbn.IdType = ItemLookupRequestIdType.ISBN; 
     request_isbn.IdTypeSpecified = true; 


     itemLookup.Request = new ItemLookupRequest[] { request_isbn }; 
     itemLookup.AssociateTag = "my astag"; 

     ItemLookupResponse response_isbn = new ItemLookupResponse(); 

      response_isbn = amazonClient.ItemLookup(itemLookup); 



     string _Description = ""; 
     foreach (var revitem in response_isbn.Items[0].Item) 
      { 

       if (revitem.EditorialReviews != null) _Description = revitem.EditorialReviews.Last().Content.ToString(); //Sometimes is null even if there is Product Description avaliable on the Amazon Web 

      } 
+0

這將更好地指向亞馬遜我會想象的人。我的一個問題是,如果所有的編輯評論都採用相同的方式。 –

+0

不,其中一些由ItemLookupResponse正確返回 – Andy

回答