Загрузка страницы

Learning GraphQL With Postman

Welcome to Advanced Postman with DevOdyssey! Today’s episode is Learning GraphQL with Postman.

This episode covers the fundamentals of GraphQL, importing GraphQL Schema in Postman as an API, and how to execute GraphQL requests in Postman. Postman’s GraphQL client is more powerful than your standard GraphQL client, given it integrates with all features of regular requests in Postman, making testing and implementing your GraphQL API a breeze.

Here are the show notes so you can follow along.

GraphQL - Graph Query Language
DevOdyssey’s Definition - An API protocol or paradigm that focuses on comprehensive data retrieval via a query syntax, similar to that of Structured Query Language (SQL) for querying databases.

GraphQL has two basic operations: query and mutation
Query - Read data (pulling data)
Mutation - create, update, delete data (changing data)

Queries and mutations are done via the request body, use JSON syntax, and generally are executed with POST request.

Queries and mutations are defined by a GraphQL Schema, where you define your variables, functions and objects. They can be of standard primitive types (string, number, etc) or custom types (objects, elements, etc).

Video Example: SpaceX.land GraphQL
A community curated api of SpaceX data from Reddit, and not SpaceX official.

*Refer to the Postman Collection below to see the queries used in this video*

Authentication is not within the scope of GraphQL - Protected via other standards and protocols, such as OAuth 2.0, Basic Authentication, etc.

GraphQL has a variables section that allows you to use parameterize your GraphQL queries and mutations for simplicity of use.

GraphQL sends response data wrapped in a "data" object.

GraphQL uses "$" notation for referencing variables.

GraphQL requires explicit definition of object attributes. If not defined, the query will result in a syntax error.

The "query" command can be omitted at the beginning of a new query when not using variables.

The "mutation" command requires a server defined function and a "returning" object, that tells the GraphQL server what information to return.

GraphQL vs. REST

Rest is Resource Based
REST returns full object returned with all attributes, could be filtered with query parameters if implemented by developer
GraphQL uses one endpoint; REST uses multiple endpoints / urls

GraphQL vs. SOAP

SOAP is XML based
GraphQL is JSON based
SOAP uses SOAP Messages, SOAP Headers etc, GraphQL has no equivalent.

GraphQL Pros & Cons

Reduce response size
Decrease Client Processing / Filtering
More Efficient Data at Retrieval, But uses Larger Request Size

Resources:

SpaceX.Land GraphQL
Medium Article - https://medium.com/open-graphql/launching-spacex-graphql-api-b3d7029086e0
GraphiQL Client - https://api.spacex.land/graphql/
SpaceX.Land GraphQL code - https://codesandbox.io/s/yv004pqnq9
SpaceX.Land GraphQL Schema - https://codesandbox.io/s/github/spacexland/api/tree/master/?file=/schema.graphql

Postman Learning Center (Docs) - Querying with GraphQL
https://learning.postman.com/docs/sending-requests/supported-api-frameworks/graphql/

Postman Collection SpaceX.Land GraphQL
https://documenter.getpostman.com/view/7889102/T1LMiT13

GraphQL official website
https://graphql.org/

Background Music:

For The Love Of - StayLoose
https://www.youtube.com/watch?v=aUmEUzD1pcg

StayLoose Channel
https://www.youtube.com/user/stelouse

Видео Learning GraphQL With Postman канала Dev Odyssey
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
14 августа 2020 г. 21:33:13
00:13:04
Яндекс.Метрика