A complete introduction to GraphQL

GraphQL is a query language that lets your client request the server to send only the required data.

Let's deep dive into it. ๐Ÿงต๐Ÿ‘‡๐Ÿป
GraphQL was created by developers at Facebook in 2012.

GraphQL was developed to support the complicated data structures required to show the Facebook News Feed on the mobile application.
Using GraphQL, the client can request the necessary data using a single endpoint with a defined schema.
Considering you're building a blogging platform, you will need to fetch posts, author, published date, comments, and other associated data with a particular post.
With a standard REST API, you can design such an API very easily.

But now consider that you want to display comments only on the web app, not the mobile app.

It's almost impossible to achieve this with a single REST API.
This is where GraphQL can help you.

The client can ask for the data they need, and the server will return with only that data.
GraphQL relies on a strongly typed schema.

This means that the schema acts as a contract between the client and the server. The predefined schema is what allows the client to specify the exact shape of the data returned.
This Schema is known as Schema Definition Language.

Schema Definition Language is nothing but the syntax of writing schemas in GraphQL query language, and it's pretty intuitive.
Consider the `User` schema below written in Schema Definition Language: ๐Ÿ‘‡๐Ÿป

The `User` type has two fields, `name` and `email` with type String. type User {	   name: String!   email: String! }
The exclamation mark (!) at the end depicts that the fields are required.
Moving forward, Schema Definition Language allows you to establish relationships between types.

For example, a `Blog` is associated with a particular `User`. type User {	   name: String!	   email: String!:   blogs: [Bl
There are two GraphQL operations - Queries and Mutations using which you can fetch data and save data to the GraphQL server.
โ—พ Queries

When requesting data from a GraphQL server, the client has to send some information to the server. Based on this information, the server will send the response. This information is known as a query. { 	user(id: 1) { 		name 		email 	} }
โ—พ Mutations

When you want to save data to a GraphQL server, you can use a "mutation". You can create, update, and delete data from a GraphQL server using mutations. { 	createUser( 		name: "John Doe", 		email: "
The ability of GraphQL to define the exact request and response structure helps us cut down on the resources and bandwidth required to fetch data.

Hence, GraphQL APIs would be a great choice to reduce the number of queries needed to fetch the necessary data.
With that being said, this is the end of this thread. We hope you found this thread helpful.๐Ÿ’™

Head over to RapidAPI Hub(RapidAPI.com/hub?utm_sourceโ€ฆ) and get access to excellent GraphQL APIs.
Visit RapidAPI Learn (RapidAPI.com/learn/graphql-โ€ฆ) and play around with interactive components.

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with RapidAPI

RapidAPI Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Rapid_API

1 Dec
Top five Visual Recognition APIs you can use to build excellent web applications.

Thread ๐Ÿงต๐Ÿ‘‡๐Ÿป
1๏ธโƒฃ Face Detection

Face Detection API helps you detect the location of human faces in your images with optional extra features like Age and Gender.

๐Ÿ”— RapidAPI.com/inferdo/api/faโ€ฆ

๐Ÿ“ˆ Popularity: 9.7/10
๐Ÿ•› Latency: 1,149ms
โœ… Service Level: 100%
2๏ธโƒฃ Brand Recognition

This ready-to-use API provides high-accuracy brand detection and logo recognition.

๐Ÿ”— RapidAPI.com/api4ai-api4ai-โ€ฆ

๐Ÿ“ˆ Popularity: 8.6/10
๐Ÿ•› Latency: 911ms
โœ… Service Level: 100%
Read 7 tweets
29 Nov
A complete introduction to RPC and gRPC

Microservices are usually written in different languages, making it challenging to manage them and exchange information.

Here gRPC comes into play.

Thread ๐Ÿงต๐Ÿ‘‡๐Ÿป
Before jumping onto gRPC, we need to understand what RPC is ๐Ÿ‘‡๐Ÿป
๐Ÿ“Œ RPC

RPC stands for Remote Procedure Call, and it's a client-server communication method in use today.

In typical HTTP, the client makes a request and gets a response from the server.
Read 9 tweets
26 Nov
There are different kinds of specifications available that you can use while building an API.

In this thread, we will talk about the OpenAPI spec.

๐Ÿงต ๐Ÿ‘‡๐Ÿป
In simple terms, OpenAPI spec is a format to define structure and syntax for REST APIs.
OpenAPI spec provides a standard that allows both humans and computers to discover and understand the service's capabilities without access to source code, documentation, or traffic inspection
Read 13 tweets
25 Nov
CORS can be tackled quickly with the understanding of a few HTTP headers.

Let's discuss them in a bit more detail. ๐Ÿงต๐Ÿ‘‡๐Ÿป
We are going to cover HTTP request headers first, and then we will jump onto HTTP response headers.
๐Ÿ“Œ HTTP Request Headers

The client can use a few HTTP request methods with their API calls in order to make maximum use of the Cross-Origin resource sharing feature.
Read 12 tweets
23 Nov
Authentication and Authorization are generally the two most confusing terms when used together.

Let's discuss some key points of these two terms.

๐Ÿงต๐Ÿ‘‡๐Ÿป
In simple terms, authentication is the process of verifying the identity of a user.
Your ID and password are verified using the authentication process when you sign up or sign in.

Modern software implements biometric authentication which is associated with your fingerprint or facial recognition.
Read 7 tweets
19 Nov
There are four types of Web APIs:

- Public API
- Private API
- Partner API
- Composite API

Let's discuss them in detail ๐Ÿงต๐Ÿ‘‡๐Ÿป
1๏ธโƒฃ Public API

Public APIs are accessible to all developers with a low or moderate level of authentication and authorization.

For example, the Windows API of Microsoft is a public API.
Stability is an essential factor of any public API. Any changes in the public API, let's say adding a new parameter, might break the applications that depend on that API.
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!

:(