I use the Selling Partner API for PHP from jlevers
(https://github.com/jlevers/selling-partner-api)
Connection works after a lot of reading posts. I can get orders, order items and so on.
Now I want to try to upload product data to amazon.
Is it possible to upload the product in json format ? Or is it normal that we still upload the product data in xml format? I cant find a PHP example with json format.
I found this example:
https://spapi.cyou/en/use-case/feeds-api-use-case-guide_2021-06-30.html#xml-feeds
My second question is, if I can get the categories from amazon with a Api call or is it still just an XSD file?
A way i did this in XML format in java is like this:
StringBuilder stringBuilder = new StringBuilder(); //everything is hardcoded except sku & quantity
stringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("\n");
stringBuilder.append("<AmazonEnvelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\">").append("\n");
stringBuilder.append("<Header>").append("\n");
stringBuilder.append("<DocumentVersion>1.01</DocumentVersion>").append("\n");
stringBuilder.append("<MerchantIdentifier>A24AHHJKC9JJQL</MerchantIdentifier>").append("\n");
stringBuilder.append("</Header>").append("\n");
stringBuilder.append("<MessageType>Inventory</MessageType>").append("\n");
stringBuilder.append("<Message>").append("\n");
stringBuilder.append("<MessageID>1</MessageID>").append("\n");
stringBuilder.append("<Inventory>").append("\n");
stringBuilder.append("<SKU>").append(sku).append("</SKU>").append("\n"); //------>> SKU
stringBuilder.append("<Quantity>").append(quantity).append("</Quantity>").append("\n"); //------>> Quantity
stringBuilder.append("</Inventory>").append("\n");
stringBuilder.append("</Message>").append("\n");
stringBuilder.append("</AmazonEnvelope>");
Only SKU and Quantity are variables and have to be inputted by the program
Related
Need to search multiple product codes using using SolrSearchQueryTemplate so that we can get all products in a single solr call
I am able to search one product code at a time using SolrSearchQueryTemplate but not sure how shall modify solr query so that i can pass multiple product codes in solr request
please find below implementation i have done to search single product code using SolrSearchQueryTemplate and it works fine
$productType=testProductType
$ftsQueryBuilder=multiFieldFreeTextQueryBuilder
INSERT_UPDATE SolrSearchQueryTemplate;name[unique=true];ftsQueryBuilder[default=$ftsQueryBuilder];showFacets;restrictFieldsInResponse;indexedType(Identifier)[default=$productType]
;TESTTEMPLATE;;false;true;
INSERT_UPDATE SolrSearchQueryProperty;ftsQuery;indexedProperty(name)[unique=true];searchQueryTemplate(name)[unique=true]
;true;code;TESTTEMPLATE
final PageableData pageableData = createPageableData(0, getSearchPageSize(), null, ShowMode.Page);
final SearchStateData searchState = new SearchStateData();
final SearchQueryData searchQueryData = new SearchQueryData();
searchQueryData.setValue(XSSFilterUtil.filter(prodIdentifier.get(0)));
searchQueryData.setSearchQueryContext(SearchQueryContext.THIRDPARTYINTEGRATION);
searchState.setQuery(searchQueryData);
pageableData.setFlow(MyConstants.THIRDPARTYINTEGRATION);
final ProductSearchPageData<SearchStateData, de.hybris.platform.commercefacades.product.data.ProductData> searchPageData = testCloudProductSearchFacade
.getProductByCodeMafIdBrand(searchState, pageableData, MyConstants.THIRDPARTYINTEGRATION);
List<ProductData> prodFromSolr = searchPageData.getResults();
let me know what modifications are required to be done in this so that i can pass multiple product codes in request
Note:
searchQueryData.setValue(XSSFilterUtil.filter(prodIdentifier.get(0)));
setValue method accepts single parameter of type String
is it possible to send multiple codes separated by some token which SolrSearchQueryTemplate will automatically consider as multiple search terms
I was looking for a way to upload a text file of dictionary of synonyms in azure search, the nearest I could find was
https://azure.microsoft.com/en-in/blog/azure-search-synonyms-public-preview/
https://learn.microsoft.com/en-us/azure/search/search-synonyms
I know it is not a good idea to compare products of different companies, but if there exists a way to upload a dictionary of synonyms in azure search like it is supported in elastic search, then it will of great help and might save a lot of time and rework.
Please help me know how to achieve such thing like uploading the dictionary of the synonym in azure search
The latest .NET SDK for Azure Cognitive Search has this capability. From this sample:
// Create a new SearchIndexClient
Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT"));
AzureKeyCredential credential = new AzureKeyCredential(
Environment.GetEnvironmentVariable("SEARCH_API_KEY"));
SearchIndexClient indexClient = new SearchIndexClient(endpoint, credential);
// Create a synonym map from a file containing country names and abbreviations
// using the Solr format with entry on a new line using \n, for example:
// United States of America,US,USA\n
string synonymMapName = "countries";
string synonymMapPath = "countries.txt";
SynonymMap synonyms;
using (StreamReader file = File.OpenText(synonymMapPath))
{
synonyms = new SynonymMap(synonymMapName, file);
}
await indexClient.CreateSynonymMapAsync(synonyms);
The SDKs for Java, Python, and Javascript also support creating synonym maps. The Java SDK accepts a string rather than a file stream, so you'd have to read the file contents yourself. Unfortunately the Python and Javascript SDKs seem to require a list of strings (one for each line of the file), which is something we should improve. I'm following up with the Azure SDK team to make these improvements.
I know how to connect to Infusionsoft with Python 3 and how to process the following simple example:
#Set up the contact data we want to add
contact = {}; #blank dictionary
contact[“FirstName”] = “John”;
contact[“LastName”] = “Doe”;
contact[“Email”] = "john#doe.com";
contact[“Company”] = “ACME”;
But how do I mass update the WHOLE database? e.g. If I want to update ALL The Phone1 fields with an extra bit of code using IF statements.
Using Infusionsoft API you can only update contacts data one by one, sending a separate request per contact. Exact request depends on which type of API you use: REST or XML-RPC
If you search on amazon for, say, "Don Quixote Spanish/English" you will find a number of matches or near-matches at http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=Don%20Quixote%20Spanish%2FEnglish
You can then select any of them, and the URL will contain a designator (ASIN) for the product. For example, if you select a particular item in the result set, its URL might be:
http://www.amazon.com/Don-Quixote-Spanish-English-Complete-ebook/dp/B00JQRGICM/ref=sr_1_4?ie=UTF8&qid=1405527063&sr=8-4&keywords=Don+Quixote+Spanish%2FEnglish
The key piece of data here is the ASIN ("B00JQRGICM"); if you google using that alone, it will find many places where that product is referenced on the Internet.
My question is, does amazon provide an API whereby you can pass a search phrase (such as "Don Quixote Spanish/English") that will return to you an array of ASINs and other relevant data ("B00JQRGICM" and others)?
For example, I would like to call it something like this:
api/Books?SearchStr=Don Quixote Spanish/English
...and get back json such as:
{
Title: "Don Quixote in Spanish and English: Complete (Vol I & Vol II)"
Price: 16.15
ASIN: "B00JQRGICM"
Image: "http://ecx.images-amazon.com/images/I/519dhx-MSOL._SL160_.jpg"
}
. . .
If there is such an API, has anybody here got experience in using it/sample code?
Yes. You can search Amazon and get an XML response with the ASINs using the ListMatchingProducts operation of the MWS Products API.
Here's the documentation with a sample request & response:
http://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
An easy way to test this is using the MWS Scratchpad: https://mws.amazonservices.com/scratchpad/index.html
I am new to Amazon MWS API. I am working on Product feed and having problem with SKU. My scenario is when SKU length is less than 12 then add "WH" string with SKU value. For example if SKU is 920126, it will become WH920126.
When i get Amazon feed submission result, i get error message:
Invalid ProductType value for SKU: [WH920126].
According to the Amazon data definitions, SKU is an alphanumeric string; 1 character minimum in length and 40 characters maximum in length.
Any idea what is wrong with it?
Thanks in advance!
I got a same error..
I figured out the problem is if you delete any product from amazon you cannot upload product with same SKU which you deleted for another 24hours..
So it keeps saying Invalid ProductType value for SKU in my case.
Let Assume you uploaded a product successfully with SKU 4001 and deleted it for some reason (Using seller account). You cannot upload product with SKU 4001 for next 24 Hours. So try using different SKU then you might upload a product to amazon successfully.
Hope this helps.. Please let me know if any other reasons too..