IKaRuS1978
Neues Mitglied
Hallo zusammen,
ich beschäftige mich gerade mit den Affilinet Webservices, dort insbesondere mit dem direkten Abruf von Produktdaten.
Wenn ich hier nun den Code von Affilinet nehme:
// Set webservice endpoint (JSON)
$service = "https://product-api.affili.net/V3/productservice.svc/JSON/SearchProducts";
// If you want to get the response in XML use the following service url
//$serviceXML = "https://product-api.affili.net/V3/productservice.svc/XML/SearchProducts";
// Set credentials
$params['PublisherId'] = '****'; // your publisher ID
$params['Password'] = '****'; // your product web services password
// Narrow down results to specific Shops (optional)
$params['ShopIds'] = '2071'; // enter one or more shop Ids as comma separated list. You can use "GetShopList" to receive Shop Ids
$params['ShopIdMode'] = 'Include';
/**
* Narrow down by Query, CategoryIds or FilterQueries (on of the three must be set)
*
* Query
* Use search operators AND, OR, NOT (in capital letters) for better results
* Use "" for an exact match
* Use () to group expressions
* Use wildcard * for suffix matching, e.g. 'bott*' will match bottle or bottom
* Example: "apple ipod" ((touch OR classic) NOT nano) AND "32 GB"
*/
$params['Query'] = 'battlefront'; //
/**
* CategoryIds
* The Ids of the categories you wish to restrict the search on. Whether the Ids are to be interpreted as shop categories
* or as affilinet categories can be specified by using the parameter "UseAffilinetCategories".
* You can receive shop categories using "GetCategoryList".
*/
$params['CategoryIds'] = '';
$params['UseAffilinetCategories'] = 'true';
$params['ExcludeSubCategories'] = 'false';
/**
* Filter Queries (FQ)
* With the FilterQuery functionality, you can restrict the search results to those products that have a certain value (e.g. "Sony") in a certain data field (e.g. "Brand"). You can define up to 15 FilterQueries at the same time.
* The fields and values must be URL encoded.
*/
$param['FQ'] = urlencode('fq=DataField:EAN');
/**
* Facet fields
* With this parameter, you can specify, what facets shall be created out of the search results (e.g. "Brand", "ShopId",
* "AffilinetCategoryPath" or "Property_Size"). See PDF documentation for a full list.
*/
$params['FacetFields'] = 'ShopId,ShopName,EAN';
$params['FacetValueLimit'] = 5;
// Page settings
$params['CurrentPage'] = 1;
$params['PageSize'] = 20;
$params['SortBy'] = 'Score';
$params['SortOrder'] = 'descending';
// Set further parameters
$params['ImageScales'] = 'Image90,Image180';
$params['LogoScales'] = 'Logo90,Logo150';
$params['WithImageOnly'] = 'true';
$params['MinimumPrice'] = 0;
$params['MaximumPrice'] = 0;
// Put together request
$request = $service . "?" . http_build_query($params);
// Get response
$response = file_get_contents($request, true);
/*
Please note: the JSON output begins with a byte order mark (BOM).
If you run into problems while parsing the JSON response, try removing the BOM first.
*/
if(substr($response,0,3) == pack("CCC", 0xEF,0xBB,0xBF)) {
$response = substr($response,3);
}
// Show response
//print_r($response);
Dieser Code wirft Ergebnisse zum Thema "Battlefront" aus...als JSON String.
So weit so gut....Script an sich funktioniert.
Nur wenn ich jetzt statt nach dem Titel ("Battlefront") nach einer EAN suche, bekomme ich kein Ergebnis.
Wenn ich aber direkt auf der Homepage des Advertisers nach der EAN suche, hab ich sofort einen Treffer.
Wenn ich mir die Daten aus dem JSON-Response mit o.g. Code ansehe, wird die EAN auch mitgeliefert.
Nur der direkte Abruf mit EAN als Suche...das klappt nicht.
Hat jemand eine Idee dazu?
ich beschäftige mich gerade mit den Affilinet Webservices, dort insbesondere mit dem direkten Abruf von Produktdaten.
Wenn ich hier nun den Code von Affilinet nehme:
// Set webservice endpoint (JSON)
$service = "https://product-api.affili.net/V3/productservice.svc/JSON/SearchProducts";
// If you want to get the response in XML use the following service url
//$serviceXML = "https://product-api.affili.net/V3/productservice.svc/XML/SearchProducts";
// Set credentials
$params['PublisherId'] = '****'; // your publisher ID
$params['Password'] = '****'; // your product web services password
// Narrow down results to specific Shops (optional)
$params['ShopIds'] = '2071'; // enter one or more shop Ids as comma separated list. You can use "GetShopList" to receive Shop Ids
$params['ShopIdMode'] = 'Include';
/**
* Narrow down by Query, CategoryIds or FilterQueries (on of the three must be set)
*
* Query
* Use search operators AND, OR, NOT (in capital letters) for better results
* Use "" for an exact match
* Use () to group expressions
* Use wildcard * for suffix matching, e.g. 'bott*' will match bottle or bottom
* Example: "apple ipod" ((touch OR classic) NOT nano) AND "32 GB"
*/
$params['Query'] = 'battlefront'; //
/**
* CategoryIds
* The Ids of the categories you wish to restrict the search on. Whether the Ids are to be interpreted as shop categories
* or as affilinet categories can be specified by using the parameter "UseAffilinetCategories".
* You can receive shop categories using "GetCategoryList".
*/
$params['CategoryIds'] = '';
$params['UseAffilinetCategories'] = 'true';
$params['ExcludeSubCategories'] = 'false';
/**
* Filter Queries (FQ)
* With the FilterQuery functionality, you can restrict the search results to those products that have a certain value (e.g. "Sony") in a certain data field (e.g. "Brand"). You can define up to 15 FilterQueries at the same time.
* The fields and values must be URL encoded.
*/
$param['FQ'] = urlencode('fq=DataField:EAN');
/**
* Facet fields
* With this parameter, you can specify, what facets shall be created out of the search results (e.g. "Brand", "ShopId",
* "AffilinetCategoryPath" or "Property_Size"). See PDF documentation for a full list.
*/
$params['FacetFields'] = 'ShopId,ShopName,EAN';
$params['FacetValueLimit'] = 5;
// Page settings
$params['CurrentPage'] = 1;
$params['PageSize'] = 20;
$params['SortBy'] = 'Score';
$params['SortOrder'] = 'descending';
// Set further parameters
$params['ImageScales'] = 'Image90,Image180';
$params['LogoScales'] = 'Logo90,Logo150';
$params['WithImageOnly'] = 'true';
$params['MinimumPrice'] = 0;
$params['MaximumPrice'] = 0;
// Put together request
$request = $service . "?" . http_build_query($params);
// Get response
$response = file_get_contents($request, true);
/*
Please note: the JSON output begins with a byte order mark (BOM).
If you run into problems while parsing the JSON response, try removing the BOM first.
*/
if(substr($response,0,3) == pack("CCC", 0xEF,0xBB,0xBF)) {
$response = substr($response,3);
}
// Show response
//print_r($response);
Dieser Code wirft Ergebnisse zum Thema "Battlefront" aus...als JSON String.
So weit so gut....Script an sich funktioniert.
Nur wenn ich jetzt statt nach dem Titel ("Battlefront") nach einer EAN suche, bekomme ich kein Ergebnis.
Wenn ich aber direkt auf der Homepage des Advertisers nach der EAN suche, hab ich sofort einen Treffer.
Wenn ich mir die Daten aus dem JSON-Response mit o.g. Code ansehe, wird die EAN auch mitgeliefert.
Nur der direkte Abruf mit EAN als Suche...das klappt nicht.
Hat jemand eine Idee dazu?
Zuletzt bearbeitet von einem Moderator: