API: Difference between revisions

Content deleted Content added
Tag: Reverted
unsourced addition, possibly LLM-generated
 
(7 intermediate revisions by 4 users not shown)
Line 1:
{{short description|Connection between computers or programs}}
{{other uses}}
{{other uses}}An '''application programming interface''' ('''API''') is a connection or fetching, in technical terms, between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build such a connection or interface is called an ''API specification''. A computer system that meets this standard is said to ''implement'' or ''expose'' an API. The term API may refer either to the specification or to the implementation.
{{hatnote|"Api.php" redirects here. For the Wikipedia API, see {{Plain link|[Special:ApiHelp]}}.|selfref=true}}
 
InAn contrast'''application to a userprogramming interface,''' which('''API''') connectsis a computerconnection tobetween a person, an application programming interface connects computers[[computer]]s or piecesbetween of[[computer software to each otherprogram]]s. It is nota intendedtype toof besoftware used[[Interface directly(computing)|interface]], byoffering a personservice (the end user)to other thanpieces aof computer programmer[[software]].<ref name=":0">{{cite book |last=Reddy |first=Martin |author-link= |date=2011 |title=API Design for C++ |url=https://books.google.com/books?id=IY29LylT85wC |title=API Design for C++ |date=2011 |publisher=Elsevier Science |isbnpage=97801238500411 |pageisbn=19780123850041}}</ref> whoA isdocument incorporatingor itstandard intothat software.describes Anhow APIto isbuild oftensuch madea up of different parts which act as toolsconnection or servicesinterface thatis arecalled availablean to''API the programmerspecification''. A programcomputer or a programmersystem that usesmeets onethis of these partsstandard is said to ''callimplement'' thator portion''expose'' of thean API. The calls that make up theterm API aremay alsorefer knowneither asto subroutines,the methods, requests,specification or endpoints. An API specification ''defines'' these calls, meaning that it explains how to use or implementthe themimplementation.
 
In contrast to a [[user interface]], which connects a computer to a person, an application programming interface connects computers or pieces of software to each other. It is not intended to be used directly by a person (the [[end user]]) other than a [[computer programmer]]<ref name=":0" /> who is incorporating it into software. An API is often made up of different parts which act as tools or services that are available to the programmer. A program or a programmer that uses one of these parts is said to ''call'' that portion of the API. The calls that make up the API are also known as [[subroutine]]s, methods, requests, or [[communication endpoint|endpoint]]s. An API specification ''defines'' these calls, meaning that it explains how to use or implement them.
One purpose of APIs is to hide the internal details of how a system works, exposing only those parts a programmer will find useful and keeping them consistent even if the internal details later change. An API may be custom-built for a particular pair of systems, or it may be a shared standard allowing interoperability among many systems.
 
One purpose of APIs is to [[information hiding|hide the internal details]] of how a system works, exposing only those parts a programmer will find useful and keeping them consistent even if the internal details later change. An API may be custom-built for a particular pair of systems, or it may be a shared standard allowing [[interoperability]] among many systems.
The term API is often used to refer to web APIs, which allow communication between computers that are joined by the internet. There are also APIs for programming languages, software libraries, computer operating systems, and computer hardware. APIs originated in the 1940s, though the term did not emerge until the 1960s and 70s.
 
The term API is often used to refer to [[web APIsAPI]]s,<ref name="Lane2019"/> which allow communication between computers that are joined by the [[internet]]. There are also APIs for [[programming languageslanguage]]s, [[library (computing)|software libraries]], computer [[operating systemssystem]]s, and [[computer hardware]]. APIs originated in the 1940s, though the term did not emerge until the 1960s and 70s.
 
== Purpose ==
Line 73 ⟶ 76:
}}
</ref>
 
 
===Operating systems===
Line 193 ⟶ 197:
Client code may contain innovative or opportunistic usages that were not intended by the API designers. In other words, for a library with a significant user base, when an element becomes part of the public API, it may be used in diverse ways.<ref name="MendezBaudry2013">{{Cite conference |last1=Mendez |first1=Diego |conference=2013 IEEE 13th International Working Conference on Source Code Analysis and Manipulation (SCAM) |last2=Baudry |first2=Benoit |last3=Monperrus |first3=Martin |year=2013 |isbn=978-1-4673-5739-5 |pages=43–52 |title=Empirical evidence of large-scale diversity in API usage of object-oriented software |arxiv=1307.4062 |doi=10.1109/SCAM.2013.6648183 |s2cid=6890739 |url=https://hal.archives-ouvertes.fr/hal-00844753/document}}</ref>
On February 19, 2020, [[Akamai Technologies|Akamai]] published their annual “State of the Internet” report, showcasing the growing trend of cybercriminals targeting public API platforms at financial services worldwide. From December 2017 through November 2019, Akamai witnessed 85.42 billion credential violation attacks. About 20%, or 16.55 billion, were against hostnames defined as API endpoints. Of these, 473.5 million have targeted financial services sector organizations.<ref name="VentureBeat">{{Cite web |url=https://venturebeat.com/2020/02/19/akamai-cybercriminals-are-attacking-apis-at-financial-services-firms/ |title=Akamai: Cybercriminals are attacking APIs at financial services firms |last=Takanashi |first=Dean |date=19 February 2020 |website=Venture Beat |access-date=27 February 2020}}</ref>
 
==Improving Performance==
===Horizontal Scaling===
* Load balancing - Distribute incoming requests across multiple server instances using load balancers
* Stateless design - Ensure your API doesn't store any state on local servers so that it could be scaled up easily
* Auto-scaling - adjusts the number of computing resources to match the current workload demand
* Microservices architecture - Break monolithic APIs into smaller, independent services that can be scaled individually based on demand patterns
 
===Database Scaling===
* Replica Server - Increase read-only database replicas to distribute read queries across multiple database instances
* Database sharding - Partition your data across multiple database instances based on criteria
* Connection pooling - Use connection pools to efficiently manage database connections
* Query optimization - Create indexes on columns frequently used in WHERE clauses, JOIN conditions, and ORDER BY clauses
* Use NoSQL - New nodes can be added on the fly without worrying about the consistency of data
 
===Caching Strategies===
* Memory Cache - Cache frequently requested data in memory using Redis, Memcached
* Content Delivery Networks - cache static content and API responses closer to users geographically
* Client-Side Caching - Let the browser or mobile app cache responses, use Last-Modified headers
 
===API Design for Scale===
* Pagination - Implement cursor-based or offset-based pagination to handle large result sets efficiently
* Rate limiting - Implement throttling ensure fair resource usage across clients
* Field selection - Allow clients to specify which fields they need to reduce payload size and processing time
* Multiple operations - Provide endpoints for batch operations to reduce the number of api calls
 
==Documentation==