Skip to content

LD4P/sinopia_cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sinopia_cli

Commandline Interface to Sinopia API

Note this only supports part of the Sinopia API. Additional support will be added as necessary.

Usage

$ exe/sinopia-cli -h
Commands:
  sinopia-cli help [COMMAND]               # Describe available commands or one specific command
  sinopia-cli resource SUBCOMMAND ...ARGS  # commands for resources

List resources

$ exe/sinopia-cli resource help list
Usage:
  sinopia-cli resource list

Options:
  [--uri-only], [--no-uri-only]              # Print resource URIs only.
  [--templates-only], [--no-templates-only]  # Resource templates only.
  [--group=GROUP]                            # Group name filter.
  [--updated-before=UPDATED_BEFORE]          # Resource last updated before filter, e.g., 2019-11-08T17:40:23.363Z
  [--updated-after=UPDATED_AFTER]            # Resource last updated after filter, e.g., 2019-11-08T17:40:23.363Z
  [--type=TYPE]                              # Class filter, e.g., http://id.loc.gov/ontologies/bibframe/AbbreviatedTitle
  [--api-url=API_URL]
                                             # Default: https://api.stage.sinopia.io

For example:

$ exe/sinopia-cli resource list --uri-only --group=stanford --templates-only
https://api.stage.sinopia.io/resource/zzzzzpcc:bf2:test:Instance
https://api.stage.sinopia.io/resource/zzzzzz_pcc:bf2:Monograph:Work
https://api.stage.sinopia.io/resource/pmo:bf2:kk:AgentSimplifiedPMO:RWO
...

Note the ability to return just the URIs (--uri-only) instead of the entire resource record.

Delete resources

$ exe/sinopia-cli resource help delete
Usage:
  sinopia-cli resource delete

Options:
  [--uri=one two three]  # Space separated list of URIs.
  [--file=FILE]          # File containing list of URIs.
  [--token=TOKEN]        # JWT token. Otherwise, read from .cognitoToken
  [--api-url=API_URL]
                         # Default: https://api.stage.sinopia.io

For example:

$ exe/sinopia-cli resource delete --uri=https://api.development.sinopia.io/resource/e9a4c64a-0202-4d8b-a5ea-6785f15b2164
Deleted https://api.development.sinopia.io/resource/e9a4c64a-0202-4d8b-a5ea-6785f15b2164

Note:

  • URIs listed in a file can be deleted with --file.
  • URIs for resources that do not exist are skipped.

Copy resources

$ exe/sinopia-cli resource help copy
Usage:
  sinopia-cli resource copy

Options:
  [--uri=one two three]            # Space separated list of source URIs.
  [--file=FILE]                    # File containing list of source URIs.
  [--token=TOKEN]                  # JWT token. Otherwise, read from .cognitoToken
  [--overwrite], [--no-overwrite]  # Overwrite resource if it already exists
  [--api-url=API_URL]
                                   # Default: https://api.stage.sinopia.io

copy resources from one Sinopia environment to another

For example:

$ exe/sinopia-cli resource copy --uri=https://api.development.sinopia.io/resource/ld4p:RT:bf2:DistributionInformation --api_url=http://localhost:3000
Copied https://api.development.sinopia.io/resource/ld4p:RT:bf2:DistributionInformation to http://localhost:3000/resource/ld4p:RT:bf2:DistributionInformation (1 of 1)

Note:

  • URIs listed in a file can be deleted with --file.

Authentication

Some methods (e.g., resource delete) require a JWT token. See these instructions for obtaining a token.

The token can either be provided with --token or in a file named .cognitoToken.

About

Commandline Interface to Sinopia API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages