Login 24/7 Support Community tyk.io

1. Creating schema

  1. Create API

To start with a Universal Data Graph from scratch head over to the dashboard and click on “APIs” in the left menu. Then click the “Add New API” and UDG. You might want to give your Universal Data Graph an individual name (i.e. User-Reviews-Demo)

  1. Set Authentication

To get started easily we’ll set the API to Keyless(Open). To do this, scroll down to the Authentication section.

Note

The API authentication is set to Keyless for demo purposes, it’s not recommended to use this setting in production, we’ll explore how to secure the UDG later in this guide.

  1. Configure Schema

Switch to schema tab in your designer and you should already see a default schema. We will edit the schema as follows to connect with our datasources later.

type Mutation {
  default: String
}

type Query {
  user(id: String): User
}

type Review {
  id: String
  text: String
  userId: String
  user: User
}

type User {
  id: String
  username: String
  reviews: [Review]
}

You can also import an existing schema using the import feature, file types supported : gql , graphql and graphqls.

  1. Save

Click on save button and that should create our first UDG API


Now if we try to query our UDG API it should error at this moment as we do not have any data-source attached to it, let’s see how we can do that in next section.