Skip to main content

API

We recommend using the Web and Node SDKs for working with your data, but in cases where that is not possible, Stoker offers an API.

This API is powered by callable Cloud Functions, making it highly scalable.

To access your app's API:

  1. Authenticate a user in Firebase

  2. Use the stoker-writeapi and stoker-readapi callable functions.

Read API

Request Parameters

PropertyTypeDescription
pathstring[]The path to the collection for the record(s) i.e. ["Clients"]. If the record(s) are in a subcollection, the path will look more like ["Clients", "D89X6ZQ1sclE71BfsWmv", "Sites"].
idstringInclude an id to get a single record.
constraints[string, WhereFilterOp, unknown][]Only relevant when retrieving multiple records. Provide Firestore where() query constraints to the query.
optionsobjectAny of the options that can be provided to getOne or getSome in the Node SDK.

Returns

A result object containing either the single record or an array of records.

Write API

Request Parameters

PropertyTypeDescription
operation"create" | "update" | "delete"The write operation to perform.
pathstring[]The path to the collection for the record i.e. ["Clients"]. If the record is in a subcollection, the path will look more like ["Clients", "D89X6ZQ1sclE71BfsWmv", "Sites"].
idstringThe id of the record, if this is an update or delete operation.
recordobjectThe record to save, if this is a create or update operation.
userDataobjectAccess credentials for the record, if this is a create or update operation. See addRecord and updateRecord in the Node SDK.

Returns

A result object containing the record that was written.

Search API

Request Parameters

PropertyTypeDescription
collectionstringThe collection to search.
querystringThe search query.
hitsPerPagenumberThe number of results to return.
constraints[string, WhereFilterOp, unknown][]Provide Firestore where() query constraints to the search query.

Returns

An array of record IDs.