~denials/evergreen/master

Viewing all changes in revision 24594.

  • Committer: Galen Charlton
  • Author(s): Jeff Davis
  • Date: 2021-03-04 15:28:29 UTC
  • Revision ID: git-v1:2337f282aeb7717ca0f70272a42ab33b7e045e93
LP#169625: Support script for working with OverDrive API

Adds a script, overdrive-api-checker.pl, for testing the
OverDrive API from the command line.

USAGE:
    Open-ILS/src/support-scripts/overdrive-api-checker.pl --get-token --key <client-key> --secret <client-secret>
    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token> [ --endpoint https://api.overdrive.com/v1/libraries/1234 [ --content <content> ] ]
    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token> --oauth-only
    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token> --patron-auth [ --endpoint https://oauth-patron.overdrive.com/patrontoken ] --barcode <barcode> [ --password <password> ] --websiteid <websiteid> --authorizationname <authorizationname>

OPTIONS:
    --get-token
        Generate OverDrive API basic token.
    --key
        Client key supplied by OverDrive.  Required with --get-token.
    --secret
        Client secret supplied by OverDrive.  Required with --get-token.
    --token
        Your OverDrive API basic token (clientKey:clientSecret, Base64-encoded).
        Required unless using --get-token.
    --account
        Your OverDrive API account ID (e.g. 1234).  Not required for generating
        a basic token; required for everything else.
    --oauth-endpoint
        OverDrive API endpoint for OAuth token requests.
        Default: https://oauth.overdrive.com/token.
    --endpoint
        OverDrive API endpoint that you wish to test.
        Default: https://api.overdrive.com/v1/libraries/<account>
    --content
        JSON content of main API request.  Required only if you have specified
        an endpoint that expects JSON message content.
    --oauth-only
        Only request an OAuth token; do not attempt further API requests.
    --patron-auth
        Submit a patron authentication request.
    --barcode
        Patron barcode.  Required with --patron-auth.
    --password
        Patron password.  Required with --patron-auth if your library requires
        password for patron authentication.
    --websiteid
        Website ID supplied by OverDrive.  Required with --patron-auth.
    --authorizationname
        ILS name supplied by OverDrive.  Required with --patron-auth.
    --verbose
        Print full HTTP requests and responses.
    --help
        Print this help message.

EXAMPLES:

    To generate your basic token, given a client key and client secret supplied
    by OverDrive:

    Open-ILS/src/support-scripts/overdrive-api-checker.pl --get-token --key <client-key> --secret <client-secret>

    To send a basic API request (this is useful for validating your client
    credentials and determining whether the OverDrive API is currently
    available):

    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token>

    To send a request to a specific API endpoint:

    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token>
    --endpoint <endpoint> --content <content>

    To test OverDrive API authentication for a specific patron:

    Open-ILS/src/support-scripts/overdrive-api-checker.pl --account <account_id> --token <basic_token>
    --patron-auth --barcode <barcode> --password <password>
    --websiteid <websiteid> --authorizationname <authorizationname>

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Martha Driscoll <driscoll@noblenet.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: