What is the use of the Api interface?

        The Api interface has a very wide range of functions, especially in the Internet era, the Api interface is like a customs entrance, one man is the customs, and the man is not open. Here I quote the relevant article of Wikipedia and answer as follows:

        The operating system is the interface between the user and the computer hardware system. With the help of the operating system, the user can quickly, effectively, safely and reliably manipulate various resources in the computer system to process their own programs. To enable users to use the operating system conveniently, the OS provides users with the following two types of interfaces:

  User interface:

        The operating system specifically provides users with the "interface between the user and the operating system", usually called the user interface. This interface supports interaction between the user and the OS, that is, the user requests a specific service from the OS, and the system returns the result of the service to the user.

Program interface:

         The operating system provides programmers with "program and operating system interface", referred to as the program interface, also known as the application programming interface API (Application Programming Interface). This interface is used by programmers during programming. Through this interface, systems and applications can access resources in the system and obtain OS services during execution. It is also the only way for programs to obtain operating system services. The program interface of most operating systems is composed of a set of system calls, and each system call is a subroutine that can complete a specific function. Application programming interface, also known as application programming interface, is a collection of definitions, procedures and protocols, through the API interface to achieve mutual communication between computer software. One of the main functions of the API is to provide a common set of functions. API is also a kind of middleware, providing data sharing for various platforms. In the practice of programming, the design of programming interface must first reasonably divide the responsibilities of the software system. Good interface design can reduce the interdependence of various parts of the system, improve the cohesion of the constituent units, and reduce the degree of coupling between the constituent units, thereby improving the maintainability and scalability of the system.

classification:

Windows API

        API functions are contained in the dynamic link library file in the Windows system directory. Windows API is a set of pre-defined Windows functions used to control the appearance and behavior of various components of Windows. Every action of the user will cause one or several functions to run to tell Windows what happened. This is similar to the natural code of Windows in a way. Other languages ​​just provide a way to access the API automatically and easily. When you click a button on the form, Windows will send a message to the form. VB gets the call and generates a specific event after analysis. It is easier to understand: In addition to coordinating application execution, memory allocation, and system resource management, the Windows system is also a large service center. Calling various services of this service center (each type of service is a function) can help the application achieve the purpose of opening windows, drawing graphics, and using peripheral devices. Since these functions serve applications, they are called Application Programming Interface, referred to as API function. WIN32 API is also the application programming interface of Microsoft Windows 32-bit platform. All applications executed under the Windows working environment can call Windows API.

linux API

        In Linux, the user programming interface API follows the POSIX standard, the most popular application programming interface standard in UNIX. The POSIX standard is a standard system jointly developed by IEEE and ISO/IEC. Based on the existing UNIX practice and experience at that time, the standard describes the system call programming interface API of the operating system to ensure that application programs can be transplanted and run on multiple operating systems at the source program level. These system call programming interfaces are mainly implemented through the C library (LIBC).

Open platform

       Internet-based applications are becoming more and more popular. In this process, more sites open their own resources to developers to call. The externally provided API calls make the content relevance between sites stronger, and these open platforms also bring greater value to users, developers, and small and medium-sized websites. Opening up is a development trend, and more and more products are opening up. Websites cannot rely on restricting users to leave to retain users. The open architecture increases user stickiness. Before the arrival of the wave of Web 2.0, open APIs and even source codes were mainly reflected in desktop applications, and more and more Web applications opened APIs to developers. A Web 2.0 site with sharing, standards, decentralization, openness, and modularity. While bringing value to users, it is hoped that the services provided by the site can have a larger user base and number of service visits through open APIs . After the site launches products and services based on open API standards, there is no need to spend a lot of effort in marketing. As long as the services or applications provided are excellent and easy to use, other sites will actively integrate the services provided by the open API into their own applications. . At the same time, the service applications brought by this integrated API will also stimulate more creative applications. In order to provide a unified API interface to the outside world, it is necessary to provide an open and unified API interface environment for the sites that open resources for developers to call the API to help users access the functions and resources of the site. Of course, it is also meaningful for open API sites to provide good community support for third-party developers, which helps attract more technical personnel to participate in the open development platform and develop more interesting third-party application. Video cloud technology provider CC Video opens the API interface. Users can easily complete video upload and video playback control operations in the background of their website, and can obtain videos and platform information in batches.

What is API

        As mentioned in "What is API", API functions are contained in DLL files located in the system directory. You can enter the declaration of the API function yourself, but VB provides a simpler method, that is, use the API Text Viewer. To declare API functions in your project, just run API Text Viewer and open Win32api.txt or MDB. If you have already converted it into a database, this can speed things up. The same is true of using predefined constants and types. In addition to the meaning of "application program interface", API also refers specifically to API documentation, also known as help documentation.

common problem

        Suppose you want to declare a function in your form module, paste it and run it, VB will tell you: Compilation error...Declare statement is not allowed as a Public member in a class or object module. .. It looks terrible, in fact, all you need to do is add a Private before the declaration. Don't forget, but this will make the function available only in the form module. In some cases, you will get a prompt like "Ambiguous Name" because functions, constants, or other things share the same name. Since most functions are aliased, which means that you can use other names instead of their original names through the Alias ​​clause, you only need to change the function name and it will still work normally.

Program function

         Remote procedure call (RPC): The communication between programs is realized through the process (or task) acting on the shared data buffer. Standard Query Language (SQL): It is a standard query language for accessing data, which realizes data sharing between applications through a general database. File transfer: File transfer realizes data sharing between applications by sending formatted files. Information delivery: refers to small formatted information between loosely coupled or tightly coupled applications, and data sharing is achieved through direct communication between programs. The standards currently applied to APIs include the ANSI standard SQL API. In addition, some other standards are still under development. API can be applied to all computer platforms and operating systems. These APIs connect data in different formats. Each data format requires different data commands and parameters to achieve correct data communication, but at the same time different types of errors will be generated. Therefore, in addition to the knowledge required to perform data sharing tasks, these types of APIs must also solve many network parameter problems and possible error conditions, that is, each application must know whether it has strong performance to support inter-program communication. On the contrary, because this API only deals with one information format, the information delivery API in this situation only provides a small subset of commands, network parameters, and error conditions. Because of this, the API delivery method greatly reduces the complexity of the system, so when the application needs to share data through multiple platforms, the information delivery API type is an ideal choice.

API 与 GUI

        The API interface is an operating system or program interface, and the GUI interface is a graphics operating system. Both are direct user interfaces. Sometimes companies use APIs as their public open system. In other words, the company develops its own system interface standard. When operations such as system integration, customization, and program applications are required, all members of the company can call the source code through the interface standard. The interface standard is called open API

Reference materials:

Free experience of Api interface login: https://www.wapi.cn

This is the historical version of this entry, contributed by Tomsonyng at 2019-06-23 19:36:35: https://baike.baidu.com/history/API/10154/138455217

 

Guess you like

Origin blog.csdn.net/wapicn/article/details/112358487