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://console.rye.com
  2. Under Access and Security, view and copy your API key

Grab the API header from console

Grab the API header from console

Find out more about authorizations needed to use Rye.

2

Initialize GQL client

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

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

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

3

Making your first GraphQL request

Rye uses GraphQL as the underlying technology to expose its API to developers. Read more about GraphQL here.

Here is an example of fetching an Amazon product from GraphQL. Make sure to replace your API key in the examples below.

async function fetchProduct() {
  const variables = {
    "input": {
      "id": "7074033139917",
      "marketplace": "SHOPIFY"
    }
  };  

  const query = gql`query DemoAmazonProductFetch($input: ProductByIDInput!) {
    product: productByID(input: $input) {
      title
      vendor
      url
      isAvailable
      images {
        url
      }
      price {
        displayValue
      }
      ... on AmazonProduct {
        ASIN
      }
    }
  }`;

  const data = await client.request(query, variables, headers)
  console.log(JSON.stringify(data, undefined, 2))
}

await fetchProduct();
4

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!