What is API?
API stands for application program interface and APIs are used all over the internet in general an API is a way for a database to communicate with something else it could be an individual a website like github.com or an app like Cuba the information goes both ways and can be used as a request sending information or changing information what you need to know about API is there’s a few different types of API’s but all of them work to share information.
GraphQL vs Rest API
The differences between the graph QL API and the REST API to do that we’re going to use an example where we want some information about users who have commented on ten different issues in five different repositories all owned by the same user with the REST API we have to make sixteen different calls to get this information and each one gives us a lot of information some of the information
we need to make other calls but a lot of the information we really don’t need so we get what we need but with a lot of excess with the graph QL API we make one call and we get one response the call is a little bit more specific but the response is exactly what we asked for so the main difference between the REST API and the graph QL API is that with graph QL you make one query instead of many and you get exactly what you’re asking for with not so much access.
Query vs Mutation graphQL?
Queries and mutations in graph QL, when you’re working with graph QL there are only two types of interactions you could have either a query or a mutation a query is simply a request for information where a mutation is changing something on the database a query might be something like how many issues are in this repository in graph QL would send back a response a mutation would be I want to open a new issue in this repository graph QL still sends a response but there’s been a change on the database.
Edges and Nodes in graphQL?
Edges and nodes in graph QL, edges and nodes are important in graph QL because that’s how data is stored a node represented by one of the green boxes that’s like an array of information an edge is a connection between some of those fields of data but I just have a little bit more to them in addition to connecting information like how many issues are opened in a repository or a user that’s started a repository an edge actually stores its own metadata like when that star was
added to the repository edges and nodes are also important because when you build a mutation or a query in graph QL the way that you ask for all the information in one place is using the connections that are set up naturally with edges and notes.
Pagination in graphQL?
Pagination in graph QL pagination works differently in graph QL than it does in other more traditional API’s that’s because it uses something called a cursor which is the object at the end of every page instead of having to go through and add up every single item on a page to move on graph QL uses this cursor object to skip ahead what you need to know about pagination and cursors in graph QL is when you want to move on to the next page instead of using a page number you use the cursor.
Types Of APIs
Open Or public APIs: These are units publically out there to developers or other users with the smallest restrictions they will need registration Use of AN API key or OAuth or might utterly open they specialize in external Users to access knowledge or services.
For Example Facebook, Apple, Amazon, and Twitter have few open Apis that you’ll access victimization OAuth or API Key.
Internal or private APIs: It’s solely Internal systems expose this sort of API These square measures sometimes designed for internal use inside an organization the corporate uses this sort of API among the various Internal groups to be able to improve its product and Services.
Partner APIs: Those area unit arthropod genus exposed to the strategic business partner they’re not accessible in public and wish specific claims to access them.
Example payment entranceways like PayPal, PayU traveler service like BlueDart and DHL.
Composite APIs: These styles of genus Apis mix completely different knowledge and repair genus Apis. It’s a sequence of Tasks that run synchronously as a result of The execution and not at the request of A task. It mainly uses the square measure to hurry up the method of Execution and improve the performance of the attendee within the internet interface.
Data and Service APIs: Beyond the distinction between an interior, partner open, and composite genus Apis that we have a tendency to mention earlier we should always mention Another approach to reason genus Apis.
Data APIs: It provides produce, scans Update, and delete access to underline information sets. For varied information or SaaS cloud suppliers, these Apis are required to serve some elementary information returning from SaaS Application with ease from SaaS affiliation or internal information stores.
Internal service APIs: Consist of exposing internal services. reflective components of internal method or theme complicated actions then external service Apis square measure third party service Apis which will be simply embedded Into the prevailing service of the corporate To bring further so this is often a lot of like Partners Apis and internal service Apis square measure Internal or personal Apis that we tend to discuss earlier.
User Experience APIs: Leverage composite API to assist app developers to produce the correct expertise for every specific device like desktop, mobile, pill VPA, or IoT.
Web Service APIs or APIs protocol: A net Service may be a system or code that uses an Associate in the Nursing address that’s a computer address on the globe Wide Web to supply access to its services.
Thank you for reading if you found helpful sharing with your friends 🙂
More Articles: Tap
Follow us on instagram: Pure_coders