Home>

I'm implementing a book search function using Amazon sdk, but I don't have a Keyword selected

"// You must specify at least one of actor, artist, author, brand, keyword, title"

An error such as

is displayed.

I want to search within the range of "book (category)" and "SF (genre)" without selecting a keyword.
(If i select a keyword, you can only get books that contain that string.)

In the code below, I want to get only data that fits the specified genre without "$searchItemsRequest->setKeywords ($keyword);".

$keyword = 'Backworld';
$searchIndex = "Books";
$browseNodeId = "507300";
$itemCount = 1;
$resources = array (
    SearchItemsResource :: ITEM_INFOTITLE,
    SearchItemsResource :: OFFERSLISTINGSPRICE);
$searchItemsRequest = new SearchItemsRequest ();
$searchItemsRequest->setSearchIndex ($searchIndex);
$searchItemsRequest->setKeywords ($keyword);
$searchItemsRequest->setItemCount ($itemCount);
$searchItemsRequest->setBrowseNodeId ($browseNodeId);
$searchItemsRequest->setPartnerTag ($partnerTag);
$searchItemsRequest->setPartnerType (PartnerType :: ASSOCIATES);
$searchItemsRequest->setResources ($resources);

https: //docs.aws.amazon .com/AWSECommerceService/latest/DG/ItemSearch.html

While reading the official aws page, it says that the keyword is not required, so I'm wondering if it's necessary ...

Question 1: Is there a way to search in a broad genre called "SF" without entering any specific keywords?

Question 2: If i must absolutely include Keyword and other elements, is there a "thinking" or "idea" for searching only in a wide genre of "SF"?

I would appreciate it if you could teach me.

  • Answer # 1

    Currently not possible with APIv5.

    V4 doesn't work with Search but instead
    ASIN acquisition by Browse->Details of ASIN were acquired by Item.
    Since v5 cannot get ASIN with Browse, you have to wait for it.

Related articles