Skip to content

Memento Database API Adaptor #1336

Description

@laszcz

Request

We want to build an adaptor to integrate with the Memento Database REST API, which is a cloud-based database service that allows users to create custom databases and mobile apps. The API has strict rate limits of 10 requests per minute, and maintaining precise sync progress is critical for reliable incremental data synchronization.

To start, this adaptor should:

  1. Handle API key authentication
  2. Retrieve library data by revision - Priority feature to get all entries from a library after or at a specific revision number for incremental syncing
  3. Implement automatic rate limiting (API requests currently limited at 10 per minute) and pagination accordingly
  4. Track exact progress so operations can resume from failure points and provide resumable sync functions for incremental data collection

Credentials

  • Login credentials: API key from LP under Memento Database API
  • Base URL: https://api.mementodatabase.com/v1/
  • Test record(s): One library exist with data samples (first retrieve library id to query records)
  • Rate limit: 10 requests per minute (enforced by API)

Methods needed

See the different available methods here

API endpoints needing wrappers:

  • GET a library by id GET https://api.mementodatabase.com/v1/libraries/libraryId
  • GET all entries in a library by library id GET https://api.mementodatabase.com/v1/libraries/libraryId/entries and use startRevision and pagination
  • GET an individual entry by entry id GET https://api.mementodatabase.com/v1/libraries/libraryId/entries/entryId

Example of suggested core functions

getEntriesByRevision('libraryId', { 
  revision: 1000,
  limit: 100,
  pageToken: 'eyJvZmZzZXQiOjEwMH0' // optional, if not the first page, use the next page token to retrieve subsequent records,
  autoThrottle: true // Respects 10 req/min limit,
  trackLastRevisionRetrieved : true // returns the last full revision number completely retrieved (moved to another one higher up?) 
});
  • Retrieves all entries modified after specified revision
  • Critical for incremental synchronization
  • Parameters: revision, pageSize limit, next pageToken, autoThrottle (?)
  • Automatically handles pagination within rate limits
  • Returns: { entries: [], nextPageToken: string|null, hasMore: boolean }
get(path, options) - Generic GET request with rate limiting

Vision and use cases

Our use case: we want to retrieve periodically all entries in a library (new and updated ones thanks to revision number) to then upsert into an external database. However we will face API limit restrictions (10 per minutes) so we need to factor that in our approach. We could use collections to store current revision number (workflow 2 described below).

Workflow 1: Library Metadata Sync (Daily)
├── Job: Sync library definitions and field mappings
└── Store in OpenFn collections

Workflow 2: Incremental Data Sync (Every 10-15 mins)
├── Job 1: Fetch entries from Memento (using adaptor)
├── Job 2: Transform and process entries  
├── Job 3: Send to destination system(s)
└── Job 4: Update revision tracker

Workflow 3: Outbound Sync (Every 5 mins)
├── Job 1: Get pending changes from source
├── Job 2: Transform for Memento format
└── Job 3: Send to Memento (using adaptor)

Resources

Main API Documentation

Logo Links

Logo link

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions