Connecting an API with the Blockstack Storage

I need your help, guys.

For a Blockstack app that I am currently developing (textlibrary.co), I would love to integrate a JavaScript library that provides a set of tools for annotating content in webpages.
I get the front-end implementation running… in the browser console I can log a JSON of the annotation data … it works in a “non persistent way” just fine.

The library comes with a module that could send REST API calls to a storage.
Being more on the designing side of things … unfortunately I couldn’t figure out how I might make this work.

For the rest of the React app I use for reading and writing data from/to Gaia like demonstrated in the tutorials via “getFile(fileName, options)” etc. … but in the case of the library it might make sense if I could use the API module that is provided by this library.
The module in the library gives these options to configure the set up of the storage.

var app = new annotator.App()
      .include(annotator.storage.http, {
          prefix: 'https://gaia.blockstack.org/hub/',
          create: '/annotations',
          update: '/annotations/{id}',
          destroy: '/annotations/{id}',
          search: '/search'
          });

Here is a link to the documentation:
http://docs.annotatorjs.org/en/latest/api/storage.html#

Any idea how I could set this up, so that the Gaia storage of the user (signed in with Blockstack) would communicate with this library module?

Sorry upfront if this is not doable based on that information… or a bigger effort … I thought I might just miss an obvious thing…
Apologies again, if that’s not an easy thing to do at all …

Thanks so much for your help!

You’d have to implement your own storage adapter, it seems. You can try looking for more info here:

http://docs.annotatorjs.org/en/latest/api/storage.html?highlight=storageadapter#annotator.storage.StorageAdapter

1 Like

Thanks Michael! :pray:
Yeah I saw that it is possible to built a customised solution, though I secretly hoped that there might be an “easy” solution to get these two APIs connected via the out of the box storage module. Played with the Bucket Url for Gaia and thought maybe there is away via just configuring the storage module prefix URLs etc to get it running…

Don’t think so, sorry =(

Good luck though!

1 Like