API services Mangomag.ru

    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 and improving them.

    It will be about the most basic APIs, without which our customers would have to learn Chinese (and English), and select products not in a single convenient interface, but place orders “by throwing links to products”, as is implemented on some other sites.

    List of APIs that will be discussed :

    1) Translation service from Chinese and English to Russian;
    2) Ebay API;
    3) Amazon API;
    4) Taobao API;
    5) Aliexpress API;
    6) Parcel tracking service.


    Let's start with the most vital - the translation service from Chinese and English to Russian.

    The story below will go about the eternal struggle of a beaver with a donkey, well, you understand. )

    Initially, the good old Google Translate API was bolted to the site, and, frankly, we were quite happy with it. Stable work, adequate translation. But all free is 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 Microsoft Bing Translator API. The idea seemed not bad, and although the reviews were mixed, we got down to business with enthusiasm. Full of the most joyful forebodings, we started testing the new API ...

    Well, in our case, a serious problem was revealed: the translator did not recognize the tags, so descriptions were translated only if excessive formatting was not used or the layout was 100% valid (which, as you understand, is not so in 99%).
    After a short production meeting, the task was set to return to the bosom of the Corporation of Good, but somehow from the sub-envelope, so that there would be no round amounts.

    Our harsh programmers, tempered in battles for usability, were not at a loss and suggested this option: use the Google API only when translating categories and parameters of auction sites, and translate 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 decrease significantly.

    But ...

    “After a month of testing and dancing with a tambourine, we came to the conclusion that this thing does not work ...” (c) Senior programmer on the day of the deadline.

    image

    No, the translations of the descriptions turned out to be decent, but, here, the translation of options and categories resembled a sophisticated game in association. Especially, it was noticeable in Chinese catalogs.

    Would you like to order products from the category “Selected knowledge class” or “Block box key box”? And “Go back good”? The Ministry of Health warns, do not think too long about what this means.

    After analyzing the prospects and costs, as well as the neuro-physical state of our programmers, since Katz always offered to give up, we decided to outsource the translation of the parameters and names of all categories for Chinese sites, and part of the categories and parameters of American resources. We decided to start the translation of the remaining internals in the old fashioned way through the Google API.
    And it all worked out. Almost.

    Everything was wonderful with the translation. But a new problem arose: when confirming an order through the admin panel, the manager would have to check the product card on the seller’s original website and, if the order of the selected options did not match, check with the seller whether this type, equipment, color in stock was in the required quantity.

    But the system was decided to leave. Since, upon closer examination, this turned out to be the best option in terms of price / quality ratio. Even taking into account the costs of time managers to process orders (the chief accountant guarantees!).
    So this instructive story ended well.

    Well, the next part of our article is devoted to the four pillars on which Mangomag.ru rests: Amazon API, Ebay API, Taobao API and Aliexpress API.

    In those days when the project was just beginning, our programmers convinced their bosses 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 satisfies the requirements). Moreover, the Yii framework, on the basis of which the site is built, allows you to add functionality quickly.

    The authorities especially fell in love with the last piece of valuable information (the one about the operational addition of functionality). And since then, after each meeting, Megaplan joyfully spammed those in charge (“we need a rating output function in the form of pictures”, “we need a size calculator”, “we need a convenient slider for product photos”, etc.), but that's another story ...

    So, having received the go-ahead to use ready-made APIs, our programmers, even beardless, started with two American services (Ebay API and Amazon API). Apparently, the project manager anticipated that it was better to leave the pulp of Taobao API and Aliexpress API for later.

    In general, there were no special problems with the Americans.
    There was a small hitch with the Amazon API, associated with an abundance of functions that needed to be understood. In general, the service really impressed me with the fact that, if you wish, you can not only collect information about products, but actually create a store franchise on the basis of any thematic portal. But we were naturally interested in the data itself, and the parameters by which it was possible to filter it all, which we left.

    Having successfully screwed and debugged Amazon, we took up Ebay. Here, the programmers had to do a little magic, since at this stage of development we came to the conclusion that in the administrative part of the site it is necessary to break orders from different stores into separate positions. This was due to the fact that goods sent directly from sellers go on a different list than those that go to a warehouse in the United States. And our managers are tired of endlessly putting empty values ​​in the case of direct shipment.

    The developers did not disappoint and, in the wake of enthusiasm, with a margin expanded the capabilities of the warehouse admin area. Voila !, in addition to solving the problem (goods sent directly successfully slipped through unnecessary processes), now there are five more steps of the business process (including uploading photos for the buyer and an expanded system for commenting on the status of the order - actually a chat between a personal manager and a buyer).

    The award is already in the hands of programmers, everyone is happy and happy, but now, the Taobao API looms on the horizon ...

    image

    Given the previous success, we came to the Taobao API with complete confidence - now we’ll connect quickly and you can take a vacation. But we were met by two barriers: bureaucratic and linguistic.

    We overcame the first, remembering the popular wisdom that they did not climb into a strange monastery with their own charter. And we sent our Chinese colleagues to fight the Chinese bureaucracy. In the end, their kung fu turned out to be cooler, which cannot but rejoice.

    The language barrier was manifested in the fact that the API documentation was a set of hieroglyphs of varying severity. Without risking to use scientific poking methods, we decided to outsource the translation of documentation from the Celestial language to 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 categories of the site.

    So, the documentation has been translated, the green corridor is open, the service is screwed up and working, the American APIs are not far behind, the developers have already uncorked a bottle of champagne ...

    So, stop, where is the promised Aliexpress API? All right. He is not there. It just does not exist, which means there is yet another month ahead.

    The first option looked like this: we take the page using curl and take all the parameters to 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 make a new parser.

    Now the mechanism copes with almost all sections of Aliexpress. Well, if a new category appears, then adjusting the existing parser to it is much easier than the solution from scratch, which was in the early stages.

    In general, working with the Aliexpress platform turned out to be simple, as everything is ingenious, since we already had one platform from China. What is simplicity? Yes, that Aliexpress has drop shipping. Yes, it takes longer, and even if it is impossible to consolidate the parcels, but it’s easier for someone to “order and forget” until the coveted parcel is at the nearest post office. And frankly speaking, it was in our hands to unload the warehouse in China.

    So, here it all ended, though not quickly, but good.

    And our last story is the legend of the package tracking service .

    image

    After the first orders and repeated questions about the status of the parcels, our wise project manager realized that it was he who did not allow the client to achieve complete nirvana. And at the meeting he voiced such an idea - it would be very cool if the user can track the packages directly on the site.

    The bosses really liked this idea, and one of the developers even immediately suggested displaying statistics or functionality with a separate button for each item in the personal account.

    It sounded good, but, using user-friendly interfaces, the senior developer logically suggested that in this case, there is a high probability that the client will have to remember the password every time for a simple check. And this is not a buzz. After all, then the user would rather use the Russian or USPS mail sites directly.

    Everyone became discouraged and, taking advantage of the moment, the same senior developer (part-time also a secret admirer of bootstrap-minimalism) insisted on the availability of this service without registering to any user. And he proposed the concept itself to be implemented in the form of a search engine for two services at once: Russian Post and USPS.

    The main designer, keeping up with his colleague, described a laconic visualization - a line and a button (just like ya.ru ).

    This option was collectively approved, but during the development process there was another great idea - to improve the system of reference points for the status of the package, which can be seen on the site now. The client, checking the status of his parcel, sees transparent and understandable: “sent”, “awaiting delivery” and “received” - with dates and without unnecessary details.

    By the way, without the bureaucracy in the implementation of this service, again, it could not do. As in the case of the Taobao API, we had to enter into official correspondence in order to obtain permission to access the functionality. But our Shaolin masters managers again took the gold.

    Actually, the story with the fundamental API services ended for us, but of course we did not stop there, and we continue to improve the site so far (remember about tasks from Megaplan?).

    Summing up, we want to add that in parallel with the development of functionality, we are focused on another very important component of our project - working with clients.

    In the end, not a single program that dryly tells you that a package during delivery or a correspondence table of a Russian size range to an American one will never reach a lively dialogue with our super-nice and mega-positive managers :)

    That's why we are proud of the resulting service and hope that You will appreciate it both from a technical point of view and from a user one.

    Thank you for your attention and
    wish you successful discoveries!

    Mangomag.ru

    Also popular now: