Graphql Schema Cheat Sheet



Many companies use GraphQL including GitHub, Credit Karma, Intuit, and PayPal. This Cheat Sheet provides guidance on the various areas that need to be considered when working with GraphQL: Apply proper input validation checks on all incoming data. Table of Contents Construct dynamic schema for ‘User Greeting’ example.Transform Dogs catalog to use dynamic schema.Creating the dog typeCreating the query typeCreating a mutation typeAdding the query schemaPutting it all together For most of the cases defining a fixed schema when the application starts, by adding Query and Mutation types solely using schema language is. Character is a GraphQL Object Type, meaning it's a type with some fields. Most of the types in your schema will be object types. Name and appearsIn are fields on the Character type. That means that name and appearsIn are the only fields that can appear in any part of a GraphQL query that operates on the Character type. And over-fetching and eliminates the N problem, leading to an incredibly high-performance GraphQL API. PostGraphile is open source on Gitub, try it out today. 1 GraphQL Schema Language Cheatsheet GraphQL Schema Definition Language (SDL) allows teams of programmers and non-programmers alike to easily describe the shape of a GraphQL API using non. When you start diving into the GraphQL ecosystem, you'll probably encounter some unfamiliar terms and phrases along the way. To help you on your journey, we've defined some of the most common GraphQL vocabulary here in this handy cheat sheet. An open-source implementation of GraphQL that helps you manage data between the cloud and your UI.

Introduction

This document is meant to be an overview of all of the capabilitiesof GraphQLsheet and how you can best leverage those capabilities.We will also help you understand exactly how GraphQLsheet works,the limitations, the permissions we are requesting to access your Google accountand help you integrate the APIs you will create with your app.If you have any questions, please talk to us.

Graphql Schema File

Getting Started

The API creation is super simple. We leverage Google APIs to log you in,ask for your permission to access Google Drive and then you can create the API forthe Google Spreadsheet you want.

Overview

GraphQLsheet creates a GraphQL API from your Google Spreadsheet.Google offers a REST API that users can use but it's a lot more effort to setup yourselfand of course, it's not GraphQL. GraphQL offers many advantages over REST such as a clean, self documented API(you can access GraphiQL for your GraphQLsheet APIs), multiple requests in one and youcan request only that data fields you want.

Spreadsheets

Important: The spreadsheet must have alphanumeric string values (that don't start with a number)on the first row.The second row and the rest must have actual values (strings, number, booleans) to define the GraphQL schema.

A typical spreadsheet has columns with values with the first row having the column names.That's the assumption that GraphQLsheet is based on. We use the first row data as keysto create the GraphQLsheet schema and then analyze the column values to find patterns.If a column has numeric values, we define the GraphQL schema based on that information.We understand numbers, booleans and strings.

The spreadsheet should not have empty rows. An error will be thrown when you try to createthe API in that case.

If a spreadsheet is very big (more than 50000 values) we will not analyze it and will accept all columns asif they contain strings. Also, because we will not analyze it, any empty rows at the end will not be removedand will exist as if they contain empty string values. Feel free to remove them manually.

To sum up,This is an example spreadsheet

You can always make changes to the spreadsheet manually (through Google Drive)and re-create the API though the dashboard.

Pricing

We currently offer 2 different pricing options. In all available packages(Free, Plus, Pro), you can create as many GraphQLsheet APIs as you want.The main difference between the 2 packages is the number of requests that you can do.Please bare in mind that requests through GraphiQL are counted against your total available requests limit.

GraphQL API

If you ever used GraphQL, you know what it can do, and for sure you want touse it everywhere, and that's what GraphQLsheet is here to help with. We supportCreate Read Update and Delete operations, or Queries and Mutations as those are called in GraphQL.

Graphql Multiple Schemas

Following is a complete example of a get request in JavaScript. You can use any language to do a simple POSTrequest and use the API.Make sure to replace:

  • YOUR_API_TOKEN: with your token which you can find in your dashboard after you create your API.
  • YOUR_API_URL: with your API url, also found in the dashboard
  • YOUR_API_FIELDS: Values from the first row of your spreadhsheet

Queries

Queries are used to retrieve data. We support a single but powerful query called 'get'.

Get

It can be used to get specific rows from the spreadsheet based on the params you use.Available params:

  • limit (Int): Max # of rows to read at once (default 10)
  • offset (Int): Start reading from row # (default 0)
  • query (Object): Search for specific rows

And it will return the matched rows of the spreadsheet.

For example

Query example

Mutations

Mutations is how we change data in the spreadsheet. We support 'add', 'update' and 'remove'.

Add

This mutation allows you to add new data in the spreadsheet. That data is addedat the end of the spreadsheet. The params of this mutation depend on the structure ofyour spreadsheet and will be determined on the API creationg phase. All params are mandatory.This mutation returns the created row.

For example

Update

This mutation allows you to update specific rows in the spreadsheet. The params ofthis mutation depend on the structure of your spreadsheet and will be determined on the APIcreationg phase. Use the query to find the rows to update and the rest of the paramsfor the values you want to update. This mutation returns an array with the updated rows.

For example

Remove

This mutation allows you to remove data from the spreadsheet. The params ofthis mutation depend on the structure of your spreadsheet and will be determined onthe API creationg phase. Use the available params to find the rows to remove.This mutation returns an array with the deleted rows.

Graphql Schema Map

For example

Authentication

Each API has a unique API token that you need to send with your request to accessthe data. That API token secures that requests without it wont be able to read or write data to your spreadsheet.

Privacy

Query

The privacy and safety of your data is our top priority.We never store any data other than the first row of your spreadsheet that we use to create the GraphQL API schema.We request the minimum permissions from your Google account. Using the option to create an example spreadsheet,we request access only to that file and other files we will create for youand we can't access any other file from your account.We suggest that you use this option and then edit that example spreadsheet to paste your own data in it.Just don't forget to recreate the API (through your dashboard) after you change the spreadsheet data.

Limitations

We currently support access only to the first sheet of your spreadsheetIf you need access to a different sheet, the easiest solution right now is tocreate a new Google Spreasheet and move your data there, and create a GraphQLsheet APIfor it. Based on the user feedback we will consider adding the ability to accessmultiple sheets in the future.

HTTP Status Codes

We use stardard HTTP Status Codes to respond to your API requests

CodeDescription
200OK
400Bad Request
401Unauthorized
404Not Found
429Rate limit exceeded

Unauthorize GraphQLsheet

You can always revoke the GraphQLsheet's permission to access your Google Drive filesin the Google Account Permissions page.