Skip to content

Create O&M endpoints for soil data #11

@tomsaleeba

Description

@tomsaleeba

this issue was migrated from JIRA

The endpoints will be a point that our data can be harvested from.

We have part of this solution already but it's not yet done.

We need to figure out how to provide a JSON-LD context. Here's a demo project showing how we might do it:

# docker-compose.yml
version: '3.4'
services:
  server:
    image: postgrest/postgrest:v5.2.0
    container_name: blahrest_server
    links:
      - db:db
    environment:
      PGRST_DB_URI: postgres://${DB_USER}:${DB_PASSWORD}@db:5432/${DB_NAME}
      PGRST_DB_SCHEMA: public
      PGRST_DB_ANON_ROLE: ${DB_USER}
    ports:
      - '3000:3000'
    depends_on:
      - db
  db:
    image: postgres:10
    container_name: blahrest_db
    environment:
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - "blah-pgdata:/var/lib/postgresql/data"
volumes:
  blah-pgdata:
-- script.sql
create table theone (
  first char(10),
  second json
);

insert into theone values('one', '{"foo":123}');
insert into theone values('two', '{"bar":456}');

-- CREATE ROLE web_anon NOLOGIN;
-- grant usage on schema public to web_anon;
-- grant select on theone to web_anon;

create view thecontext as select
  -- embedded json object as context
  '{"aaa":"urn:aaa", "lh":"http://localhost:3000/theone"}'::json as context,
  -- the top level record *is* the context, if we have a separate endpoint for context
  'urn:aaa' as aaa,
  'http://localhost:3000/theone' as lh
;
# .env
DB_PASSWORD=password
DB_NAME=blah
DB_USER=postgres

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions