Skip to content

Downstream/bsuapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experimental Neo4j JSON API Plugin

Intended to be included as a Neo4j plugin, on Ubuntu 18, with Nginx control of access.

API Documentation

The API itself is meant to be self-documenting. By visiting the root of the API (/bsuapi/), all methods and parameters are listed in properties there:

  • schema - json schema for the three main types of result data
  • methods - all api methods available
  • parameters - queryString parameters available to almost every request method.
  • folders - list of folders available
  • topics - sample set of topics for every topic-type, ordered by most-connected topics first.
  • settings - all settings and configuration data for this API, and exhibit modes powered by this API.

Example URIs, with at least one example for each available method, is available here: Example API URLs

Sample GraphDB

Requirements

  • Neo4j 3.5.8

Reccommend

  • Ubuntu 18.04
  • openjdk-8-jre
  • Nginx 1.16.1
  • Neo4j 3.5.8
    • Run as neo4j (only via systemctl)
    • Roll your own auth (Not yet implemented here)
    • Only accessible via localhost
    • Nginx Reverse proxy ONLY to the methods intended to be public

Plugin provides a JSON API at http://localhost:7474/bsuapi

Installation

  • Stop the db
  • Drop a jar into $NEO4j_HOME/plugins
  • Adjust neo4j.conf
    • dbms.unmanaged_extension_classes=bsuapi.resource=/bsuapi
  • Start the db
  • http://localhost:7474/bsuapi

Ubuntu Server Provisioning

  • Install openjdk-8-jre, nginx, and neo4j
  • Adjust neo4j service def
  • Install bsuapi plugin
  • Configure neo4j
  • Configure nginx
  • Start neo4j and nginx
  • http://yourdomain.com/bsuapi

Adjust neo4j service def

Neo4j doesn't yet fully support Ubuntu 18, so an adjustment is needed for the service definition.

comment this line (those ENV vars are [TL;DR:bad])

/lib/systemd/system/neo4j.service

# Environment="NEO4J_CONF=/etc/neo4j" "NEO4J_HOME=/var/lib/neo4j"

Install bsuapi plugin

/var/lib/neo4j/plugins

Configure neo4j

/etc/neo4j/neo4j.conf

dbms.unmanaged_extension_classes=bsuapi.resource=/bsuapi
dbms.active_database=graph.db
dbms.memory.heap.max_size=48G
dbms.connectors.default_listen_address=127.0.0.1
dbms.connectors.default_advertised_address=yourdomain.com

Configure nginx

/etc/nginx/conf.d/yourdomain.conf

server {

    server_name yourdomain.com

    # magic

    location /bsuapi {
        proxy_redirect off;
        proxy_connect_timeout 30s;
        proxy_set_header Accept-Encoding "";
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:7474;
    }
}

Start neo4j and nginx

sudo systemctl start neo4j
sudo systemctl start nginx

OpenPipeline Sync

See api home: methods.execute

Pulling data from openPipeline is a multi-step process, which includes 2 stages:

  • Reset /execute/OPENPIPE_RESET - clears entire database, recreates config and indices, and sets sync to pull from assets changed after 2020-01-01.
  • Info /execute/INFO - regenerates Info Cards. See api home: methods.info and /info.
  • Sync - pulls new assets, folders, and settings, that have changed since the last time Sync was ran. Should be ran in sequence:
    • /execute/OPENPIPE_SYNC - pulls all changed assets, and extrapolates topics and meta-data, creating most of the meta-graph.
    • /execute/OPENPIPE_FOLDERS - pulls all folders and their assets, including template positioning where present.
    • /execute/OPENPIPE_TOPICIMG - attempts to select a best asset to use as the image representing a topic.
    • /execute/OPENPIPE_SETTINGS - pulls all mode settings from openpipe and connects them to their respectively selected folders/topics. Defines the preset options available for each mode.

About

Boise State World Museum Neo4j JSON API: Multiple RESTful URI methods to retrieve preset JSON representations of the graph of curated artworks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published