QT Programming QT-based Dictionary development series < Seven >--call network API

Source: Internet
Author: User

In the previous article we implemented the local thesaurus design, can complete the local search word function, then this article mainly talk about how to call the network API to implement the dictionary network search Word function .

selection of dictionary APIs

Basically on the market do dictionary software companies have corresponding APIs, such as Youdao, Jinshan and so on, but generally need API key, a little trouble, so I found a simple and easy to use scallop net api:http://www.shanbay.com/help/ developer/api/oddly enough, the API says it's going to be deactivated, and it can be done from the time I finished the software last summer, and now it works.

use of the Scallop dictionary API

To get to the API address of the scallop web I gave above, we can see that the API documentation is still more detailed. As I have never been in contact with the network programming people, can also be more understanding. Let's briefly talk about how to use these APIs. Since the function of my dictionary is only to look up words and add words, it is only necessary to use the corresponding API interface in the document.

At the beginning of the API introduction, there are the following text:

Therefore, when using this API, we must first register ! After registering and logging in, we continue to look at the API documentation, as we only implement the ability to query and save words (and, of course, other features in the document, using similar methods), so just focus on the following:

It is possible that you have seen the contents of the picture, or confused, then we can try it first. First make sure you are logged in to the scallop mesh and then enter it in the browser : Http://www.shanbay.com/api/word/test, and then we can see the following:

The content in the graph is the result of our query for the test word. If we want to save the word, we just need to enter it in the browser: http://www.shanbay.com/api/learning/add/test we get the following results:

It means that the word has been saved by us and given a number. Therefore, when we query the word again, in the browser input: Http://www.shanbay.com/api/word/test will find that the ID is no longer 0, but the same number as above:

So far, none of the above-mentioned operations involve programming, which is done directly in the browser. However, we want to implement this function in the dictionary, we have to face two problems: 1, programming to implement the user's login and call Api;2, parse the call API after the return of the JSON-formatted data.

These two issues will be resolved in the following series of articles, please pay attention to.

QT-Based Dictionary development series

    1. Dictionary frame design and finished product display
    2. Design of local dictionaries
    3. Design of the Start menu
    4. Zooming and dragging without a border window
    5. Dragging without a border window
    6. Interface beautification Design
    7. Calling the network API
    8. User login and implementation of API call
    9. JSON data parsing
    10. The display of the IPA
    11. Display of the system tray
    12. Invoke Narrator
    13. Audio playback
    14. Auto-complete function
    15. HTML special characters and regular expressions
    16. Post

Works (Released): http://download.csdn.net/detail/tengweitw/8548767
Works (green version): http://download.csdn.net/detail/tengweitw/8830495
Source: http://download.csdn.net/detail/tengweitw/8830503

Original: http://blog.csdn.net/tengweitw/article/details/45484803

Nineheadedbird

QT Programming QT-based Dictionary development series < Seven >--call network API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.