This article will focus on the development of the API services of our site - their pros and cons, as well as the problems that we encountered in the process of building them in and improving.
It will be about the most basic APIs, without which our customers would have to learn Chinese (and English), and pick up products not in a single user-friendly interface, but place orders “throwing links to products”, as implemented in some other sites.
List of API, which will be discussed :
1) Translation service from Chinese and English into Russian;
2) Ebay API;
3) Amazon API;
4) API Taobao;
5) Aliexpress API;
6) Package tracking service.
')
Let's start, perhaps, with the most burning - translation service from Chinese and English into Russian.
The story below will go about beaver's eternal struggle with a donkey, well, you get the idea. )
Initially, the good old Google Translate API was bolted to the site, and, frankly, we were quite pleased with it. Stable work, adequate translation. But all free good, someday ends. The service became paid, and, looking at the flowing banknotes of the Good Corporation, we realized that it was time to try something new.
And then someone remembered the Bing Translator API from Microsoft. The idea did not seem bad, and although the reviews were mixed, we got down to business with enthusiasm. Full of the most joyful forebodings, we began to test the new API ...
Well, in our case, a serious problem was revealed: the translator did not recognize the tags, so the descriptions were translated only if redundant formatting was not used or the layout was 100% valid (which, as you understand, 99% is wrong).
After a short production meeting, the task was to return to the fold of the Corporation of Good, but somehow out of the winding up, so that there would be no round sums.
Our hardened programmers, hardened in fights for usability, did not lose their head and offered this option: use the Google API only when translating categories and parameters of auction sites, and transfer descriptions using the translation tool for sites from the same Google (http://translate.google .com / manager / website / suggestions). No sooner said than done. The chief accountant finally recovered a dream, because, if everything works out, the costs will significantly decrease.
But…
“After a month of tests and dances with a tambourine, we came to the conclusion that this thing does not work ...” (c) Senior programmer on the deadline date.

No, the translation of the descriptions turned out to be decent, but, here, the translation of options and categories resembled a sophisticated game of association. Especially, it was noticeable in the Chinese catalogs.
Would you like to order products from the category “Selected knowledge class” or “Block box key box”? And “come back good”? Ministry of Health warns, do not think too long over what it means.
After analyzing the prospects and costs, as well as the neuro-physical condition of our programmers, since Katz always offered to give up, we decided to outsource the translation of parameters and names of all categories for Chinese sites, and some of the categories and parameters of American resources. Translation of the remaining viscera decided in the old-fashioned way to start via the Google API.
And everything turned out. Almost.
Everything was great with the translation. But there was a new problem: when confirming the order through the admin area, the manager would have to check the item card on the original site of the seller and, if the order of the selected options did not match, check with the seller whether this type, equipment, color is in stock in the required quantity.
But it was decided to leave the system. As with detailed consideration, it turned out to be the best option in terms of price / quality ratio. Even with the cost managers time processing orders (chief accountant guarantees!).
So that this instructive story ended well.
Well, the next part of our article is devoted to the four pillars on which Mangomag.ru is based:
Amazon API, Ebay API, Taobao API and Aliexpress API.In those times when the project was just being conceived, our programmers convinced the authorities that masochism is not always appropriate and it is better to take a ready-made API service rather than writing code from scratch (if the service is reliable and meets the requirements). Moreover, the Yii framework, on the basis of which the site is built, allows you to add functionality quickly.
The bosses are especially fond of the last part of valuable information (the one about the prompt addition of functionality). And since then, after each meeting, Megaplan happily spammed the mail to those in charge (“we need the function of displaying the rating in the form of pictures”, “we need a size calculator”, “we need a convenient slider of product photos”, etc.), but that's another story ...
So, having received the go-ahead for the use of ready-made APIs, our programmers, even beardless, started with two American services (the Ebay API and the Amazon API). Apparently, the project manager had a premonition that it was better to leave the Taobao API and the API API for later.
In general, there were no special problems with the Americans.
There was a slight hitch to the Amazon API related to the abundance of features that needed to be sorted out. In general, the service is really impressed by the fact that if you wish, you can not only collect information about products, but also actually create a store franchise based on any thematic portal. But we were interested, of course, directly by the data itself, and the parameters by which it was possible to filter all of this, which we left.
Successfully screwing and debugging Amazon, we took up Ebay. Here, programmers had to conjure a little, since at this stage of development we came to the conclusion that in the administrative part of the site it is necessary to split orders from different stores into separate positions. This was due to the fact that the goods sent directly from the sellers go on a different list than those that go to the warehouse in the United States. And our managers are tired of endlessly putting empty values ​​in the case of direct departure.
The developers did not let down and, on a wave of enthusiasm, expanded the possibilities of the warehouse admin with a reserve. Voila !, in addition to solving the problem (goods sent directly successfully skipped unnecessary processes), now five more steps of the business process appeared in it (including uploading photos for the buyer and an expanded system for commenting order statuses - actually a chat between the personal manager and the buyer).
The prize is practically in the hands of programmers, everyone is happy and happy, but, behold, API Taobao loomed on the horizon ...

Given the previous success, we came to the API of Taobao with full confidence - now we will connect in a quick way and we can take a vacation. But we were met by two barriers: bureaucratic and language.
We overcame the first, remembering the popular wisdom that in a strange monastery with its charter do not climb. And we sent our Chinese colleagues to fight the Chinese bureaucracy. By the end of their Kung Fu turned out to be steeper, which can not but rejoice.
The language barrier was manifested in the fact that the API documentation was a set of hieroglyphs of varying degrees of severity. Without risking the use of scientific methods, we decided to outsource the translation of documentation from the language of the Middle Kingdom into human. The company we found successfully coped with the task, and in the future it was she who helped us out with the translation of the site categories.
So, the documentation has been translated, the green corridor is open, the service is screwed up and working, the American APIs are not lagging behind, the developers have already uncorked a bottle of champagne ...
So, stop, and where is the promised API Aliexpress? That's right. He is not. It simply does not exist, which means there is still one more month of work ahead.
The first option looked like this: take the page with curl and take all the parameters into the database, cache the categories and again translate all the parameters “on the fly”. But then a new section appears on the site, where the cards are decorated differently. Well, where ours did not disappear, we do a new parser.
Now the mechanism copes with almost all sections of Aliexpress. Well, if a new category appears, then adjusting an already existing parser for it is much easier than the solution from scratch, which was in the early stages.
In general, the work with the Aliexpress site turned out to be as simple as everything is brilliant, since we already had one site from China. What is the simplicity? Yes, Aliexpress has direct delivery. Yes, it is longer, and let it be impossible to consolidate the parcels, but it is easier for someone to “order and forget” until the cherished parcel arrives at the nearest post office. Yes, and we, frankly, was on hand to unload the warehouse in China.
So, and here it was over, albeit not quickly, but well.
And our last story is the
legend of the package tracking service .

After the very first orders and recurring questions about the condition of the packages, our wise project manager understood what exactly does not allow the client to reach complete nirvana. And at the meeting I voiced such an idea - it would be very cool if the user can track the parcels directly on the site.
This idea was very much liked by the authorities, and one of the developers even suggested to display the statistics or functionality with a separate button for each item in the personal account.
It sounded good, but, with sophisticated user-interface interfaces, the senior developer logically suggested that in this case, there is a high probability that for a simple check, the client will have to remember the password every time. And this is not good. After all, then the user is more likely to use the sites of the Russian post or USPS directly.
Everyone became discouraged and, taking advantage of the moment, the same senior developer (also a secret admirer of bootstrap-minimalism) insisted on the availability of this service without registration to any user. And he proposed to implement the concept itself in the form of a search engine for two services at once: Russian Post and USPS.
The chief designer, not lagging behind his colleague, described a concise visualization - a string and a button (just like
ya.ru ).
This option was collectively endorsed, but in the development process another great idea emerged - to improve the system of reference points of the parcel status, which can be seen on the site now. The client, checking the status of his parcel, sees transparent and understandable: “sent”, “waiting for delivery” and “received” - with dates and without unnecessary details.
By the way, without bureaucracy in the implementation of this service, again, nothing happened. As in the case of the Taobao API, we had to enter into official correspondence in order to get permission to access the functionality. But our masters of Shaolin managers again took the gold.
Actually, the story with the underlying API services ended for us, but of course we didn’t stop there, and we are still working on improving the site (remember about the traffic from Megaplan?).
To summarize, we want to add that in parallel with the development of the functional, we are focused on another very important component of our project - working with clients.
In the end, no program, dryly informing you that the package in the delivery process or the table of correspondences of the Russian size range to the US, will never reach a lively dialogue with our super-pleasant and mega-positive managers :)
That is why we are proud of the resulting service and we hope that you will appreciate it both from a technical point of view and from a user point of view.
Thanks for attention,
We wish you successful discoveries!Mangomag.ru