For a live production example of creating an order using the Rye SDK in TypeScript, check out our Order from Amazon in TypeScript guide.

1

Grab your API Key

To make requests to the Rye GraphQL API, you will need to get an API access key by signing up on the Rye console. To do so:

  1. Navigate, and log in to https://staging.console.rye.com
  2. Under Access and Security, view and copy your API key

Grab the API header from console

Find out more about authorizations needed to use Rye.

2

Install a GraphQL library

Rye APIs are exposed via GraphQL. While it is possible to make requests to Rye using any HTTP client, we recommend using a dedicated GraphQL client library for ease of use. This tutorial will use the graphql-request library as it is lightweight and easy to use. You can install it using any Node.js package manager:

3

Initialize a GraphQL client

Initialize a GraphQL client with your API key via the following recipe:

import { GraphQLClient, gql } from 'graphql-request';

const endpoint = 'https://staging.graphql.api.rye.com/v1/query';
const client = new GraphQLClient(endpoint)
const headers = {
  'Authorization': 'Basic <API Key Here>',
  'Rye-Shopper-IP': '127.0.0.1',
};

For a real integration, the Rye-Shopper-IP header should be set to the IP address of the shopper making the request. This is important for fraud detection and prevention.

4

Making your first GraphQL request

Here is an example of fetching some products via GraphQL using the client we just set up.

5

Explore the rest of the API

Explore the entire API offering live on the Rye Console. Take a glance through the remaining docs to figure out how the Rye API can integrate into your app!