ohyay

learn ohyay

Welcome to the ohyay support hub, where you'll find guides and documentation to help you start building in ohyay as quickly as possible. Let's jump right in!

Get Started    

INTRODUCTION

ohyay exposes a backend API that can be used to manage rooms. All API actions are tied to your user account.

Creating an API Token

Before you can use the API, you need to create an API token, which can be done from https://ohyay.co/ohyay_api.html.

Sending a Request

Requests can be sent over HTTPS POST to the endpoint that corresponds to the operation you want to perform. The body of the request contains a JSON web token signed with your API key. The payload of the web token should contain the parameters for the request.

Example: JavaScript

The jsonwebtoken package can be used to generate the token needed for the request. Start by installing this package.

npm install --save jsonwebtoken

Once you've installed the library, you can generate requests like so

import * as jwt from 'jsonwebtoken';

// Create the request. Each request must container your user id.
// You can get your user id from https://ohyay.co/ohyay_api.html
const req = { userId: <User ID> };
const apiKey = <your api key>;
const token = jwt.sign(req, apiKey)
fetch('https://us-central1-ohyay-prod-d7acf.cloudfunctions.net/ohyayapi/list-workspaces', {
  method: 'POST',
  headers: {
    'Content-Type': 'text/plain'
  },
  body: token,
});

Example: Python

JSON web tokens can be generated in python using the pyjwt package.

pip install pyjwt
import jwt

# This example uses the requests package for HTTP requests
# It can be installed with `pip install requests`
import requests

token = jwt.encode({
  "userId": "<user id>",
}, "<api key>", algorithm="HS256")

res = requests.post(
  "https://us-central1-ohyay-prod-d7acf.cloudfunctions.net/ohyayapi/list-workspaces",
  data=token,
  headers={ "content-type": "text/plain" },
)

print(res.text) # Contains response json

Updated 3 months ago

INTRODUCTION


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.