Rebar Data API Documentation

Version: 1.0.0

POST /auth/signup No Auth

Create a new user account

Request Body:

{
  "username": "string (min 3 chars)",
  "password": "string (min 6 chars)",
  "email": "string (optional)",
  "name": "string (optional)"
}

Example Usage:

curl -X POST  http://localhost:3001/auth/signup -H "Content-Type: application/json" -d '{"username":"string (min 3 chars)","password":"string (min 6 chars)","email":"string (optional)","name":"string (optional)"}'
POST /auth/signin No Auth

Sign in to an existing account

Request Body:

{
  "username": "string",
  "password": "string"
}

Example Usage:

curl -X POST  http://localhost:3001/auth/signin -H "Content-Type: application/json" -d '{"username":"string","password":"string"}'
POST /queries/create Requires Auth

Create a new query. Queries are private by default.

Request Body:

{
  "content": "string",
  "name": "string",
  "description": "string (optional)",
  "isPublic": "boolean (optional, defaults to false)"
}

Example Usage:

curl -X POST -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/create -H "Content-Type: application/json" -d '{"content":"string","name":"string","description":"string (optional)","isPublic":"boolean (optional, defaults to false)"}'
GET /queries/public No Auth

Get all public queries, ordered by creation date (newest first)

Example Usage:

curl   http://localhost:3001/queries/public
GET /queries/:queryId Requires Auth

Get a specific query. Only accessible if query is public, you own it, or have explicit access.

Parameters:

Parameter Type
queryId string

Example Usage:

curl  -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId
PATCH /queries/:queryId Requires Auth

Update an existing query that you own

Parameters:

Parameter Type
queryId string

Request Body:

{
  "content": "string (optional)",
  "name": "string (optional)",
  "description": "string (optional)",
  "isPublic": "boolean (optional)"
}

Example Usage:

curl -X PATCH -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId -H "Content-Type: application/json" -d '{"content":"string (optional)","name":"string (optional)","description":"string (optional)","isPublic":"boolean (optional)"}'
DELETE /queries/:queryId Requires Auth

Delete a query that you own. This will also remove all saved instances and access controls.

Parameters:

Parameter Type
queryId string

Example Usage:

curl -X DELETE -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId
GET /queries/created-queries Requires Auth

Get all queries created by the authenticated user

Example Usage:

curl  -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/created-queries
POST /queries/:queryId/clone Requires Auth

Create a copy of a query. Only works for queries you own, have access to, or are public. Cloned queries are private by default.

Parameters:

Parameter Type
queryId string

Example Usage:

curl -X POST -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId/clone
POST /queries/:queryId/save Requires Auth

Save a public query to your collection. Cannot save private queries.

Parameters:

Parameter Type
queryId string

Example Usage:

curl -X POST -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId/save
GET /queries/saved-queries Requires Auth

Get all public queries saved by the authenticated user. Private queries are automatically removed from saved queries.

Example Usage:

curl  -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/saved-queries
GET /queries/user/:userId/saved-queries No Auth

Get all public queries saved by a specific user

Parameters:

Parameter Type
userId string

Example Usage:

curl   http://localhost:3001/queries/user/:userId/saved-queries
GET /queries/:queryId/save-count No Auth

Get the number of times a query has been saved

Parameters:

Parameter Type
queryId string

Example Usage:

curl   http://localhost:3001/queries/:queryId/save-count
POST /queries/:queryId/access/:userId Requires Auth

Grant access to a specific user for your query

Parameters:

Parameter Type
queryId string
userId string

Example Usage:

curl -X POST -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId/access/:userId
DELETE /queries/:queryId/access/:userId Requires Auth

Revoke access from a specific user for your query

Parameters:

Parameter Type
queryId string
userId string

Example Usage:

curl -X DELETE -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId/access/:userId
GET /queries/:queryId/access Requires Auth

Get a list of users who have access to your query

Parameters:

Parameter Type
queryId string

Example Usage:

curl  -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/:queryId/access
GET /queries/user/:userId/queries Requires Auth

Get queries created by a specific user. Returns only public queries and ones you have access to.

Parameters:

Parameter Type
userId string

Example Usage:

curl  -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:3001/queries/user/:userId/queries