VuFind API Documentation

Base
in package
implements LoggerAwareInterface Uses LoggerAwareTrait

EBSCO Search API abstract base class

Tags
category

EBSCOIndustries

author

Michelle Milton mmilton@epnet.com

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link
http://edswiki.ebscohost.com/EDS_API_Documentation

Interfaces, Classes, Traits and Enums

LoggerAwareInterface

Table of Contents

$accept  : string
Accept header
$apiHost  : string
EDS or EPF API host.
$authHost  : string
Auth host
$contentType  : string
Content type header
$orgId  : string|null
The organization id use for authentication
$searchHttpMethod  : string
Search HTTP method
$sessionHost  : string
Session host.
__construct()  : mixed
Constructor
authenticate()  : array<string|int, mixed>
Generate an authentication token with a valid EBSCO EDS Api account
autocomplete()  : array<string|int, mixed>
Execute an EdsApi autocomplete
createSession()  : array<string|int, mixed>
Creates a new session
info()  : array<string|int, mixed>
Obtain edsapi search critera and application related settings
retrieve()  : array<string|int, mixed>
Retrieves an EDS record specified by its identifiers
retrieveEdsItem()  : array<string|int, mixed>
Retrieves an EDS record specified by its identifiers
retrieveEpfItem()  : array<string|int, mixed>
Retrieves an EPF record specified by its identifiers
search()  : array<string|int, mixed>
Execute an EdsApi search
call()  : object
Submit REST Request
createQSFromArray()  : array<string|int, mixed>
Convert an array of search parameters to EDS API querystring parameters
debug()  : void
Log a debug message.
httpRequest()  : string
Perform an HTTP request.
log()  : void
Send a message to the logger.
logError()  : void
Log an error message.
logWarning()  : void
Log a warning message.
parseAutocomplete()  : array<string|int, mixed>
Parse autocomplete response from API in an array of terms
process()  : array<string|int, mixed>
Process EDS API response message
setTokens()  : array<string|int, mixed>
Populate an associative array of session and authentication parameters to send to the EDS API

Properties

$accept

Accept header

protected string $accept = 'application/json'

$apiHost

EDS or EPF API host.

protected string $apiHost

$authHost

Auth host

protected string $authHost = 'https://eds-api.ebscohost.com/authservice/rest'

$contentType

Content type header

protected string $contentType = 'application/json'

$orgId

The organization id use for authentication

protected string|null $orgId

$searchHttpMethod

Search HTTP method

protected string $searchHttpMethod = 'POST'

$sessionHost

Session host.

protected string $sessionHost = 'https://eds-api.ebscohost.com/edsapi/rest'

Methods

__construct()

Constructor

public __construct([array<string|int, mixed> $settings = [] ]) : mixed

Sets up the EDS API Client

Parameters
$settings : array<string|int, mixed> = []

Associative array of setting to use in conjunction with the EDS API

  • orgid - Organization making calls to the EDS API
  • search_http_method - HTTP method for search API calls
Return values
mixed

authenticate()

Generate an authentication token with a valid EBSCO EDS Api account

public authenticate([string $username = null ][, string $password = null ][, string $orgid = null ][, array<string|int, mixed> $params = null ]) : array<string|int, mixed>
Parameters
$username : string = null

username associated with an EBSCO EdsApi account

$password : string = null

password associated with an EBSCO EdsApi account

$orgid : string = null

Organization id the request is initiated from

$params : array<string|int, mixed> = null

optional params (autocomplete)

Return values
array<string|int, mixed>

autocomplete()

Execute an EdsApi autocomplete

public autocomplete(string $query, string $type, array<string|int, mixed> $data[, bool $raw = false ]) : array<string|int, mixed>
Parameters
$query : string

Search term

$type : string

Autocomplete type (e.g. 'rawqueries' or 'holdings')

$data : array<string|int, mixed>

Autocomplete API details (from authenticating with 'autocomplete' option set -- requires token, custid and url keys).

$raw : bool = false

Should we return the results raw (true) or processed (false)?

Return values
array<string|int, mixed>

An array of autocomplete terns as returned from the api

createSession()

Creates a new session

public createSession([string $profile = null ][, string $isGuest = null ][, string $authToken = null ]) : array<string|int, mixed>
Parameters
$profile : string = null

Profile to use

$isGuest : string = null

Whether or not this session will be a guest session

$authToken : string = null

Authentication token

Return values
array<string|int, mixed>

info()

Obtain edsapi search critera and application related settings

public info([string $authenticationToken = null ][, string $sessionToken = null ]) : array<string|int, mixed>
Parameters
$authenticationToken : string = null

Authentication token

$sessionToken : string = null

Session token

Return values
array<string|int, mixed>

retrieve()

Retrieves an EDS record specified by its identifiers

public retrieve(string $an, string $dbId, string $authenticationToken, string $sessionToken[, string $highlightTerms = null ][, array<string|int, mixed> $extraQueryParams = [] ]) : array<string|int, mixed>
Parameters
$an : string

An of the record to retrieve from the EdsApi

$dbId : string

Database identifier of the record to retrieve from the EdsApi

$authenticationToken : string

Authentication token

$sessionToken : string

Session token

$highlightTerms : string = null

Comma separated list of terms to highlight in the retrieved record responses

$extraQueryParams : array<string|int, mixed> = []

Extra query string parameters

Tags
deprecated

Use retrieveEdsItem

Return values
array<string|int, mixed>

The requested record

retrieveEdsItem()

Retrieves an EDS record specified by its identifiers

public retrieveEdsItem(string $an, string $dbId, string $authenticationToken, string $sessionToken[, string $highlightTerms = null ][, array<string|int, mixed> $extraQueryParams = [] ]) : array<string|int, mixed>
Parameters
$an : string

An of the record to retrieve from the EdsApi

$dbId : string

Database identifier of the record to retrieve from the EdsApi

$authenticationToken : string

Authentication token

$sessionToken : string

Session token

$highlightTerms : string = null

Comma separated list of terms to highlight in the retrieved record responses

$extraQueryParams : array<string|int, mixed> = []

Extra query string parameters

Return values
array<string|int, mixed>

The requested record

retrieveEpfItem()

Retrieves an EPF record specified by its identifiers

public retrieveEpfItem(string $pubId, string $authenticationToken, string $sessionToken) : array<string|int, mixed>
Parameters
$pubId : string

Id of the record to retrieve from the EpfApi

$authenticationToken : string

Authentication token

$sessionToken : string

Session token

Return values
array<string|int, mixed>

The requested record

Execute an EdsApi search

public search(SearchRequestModel $query, string $authenticationToken, string $sessionToken) : array<string|int, mixed>
Parameters
$query : SearchRequestModel

Search request object

$authenticationToken : string

Authentication token

$sessionToken : string

Session token

Return values
array<string|int, mixed>

An array of query results as returned from the api

call()

Submit REST Request

protected call(string $baseUrl, array<string|int, mixed> $headerParams[, array<string|int, mixed> $params = [] ][, string $method = 'GET' ][, string $message = null ][, string $messageFormat = '' ][, bool $cacheable = true ]) : object
Parameters
$baseUrl : string

URL of service

$headerParams : array<string|int, mixed>

An array of headers to add to the request

$params : array<string|int, mixed> = []

An array of parameters for the request

$method : string = 'GET'

The HTTP Method to use

$message : string = null

Message to POST if $method is POST

$messageFormat : string = ''

Format of request $messageBody and responses

$cacheable : bool = true

Whether the request is cacheable

Tags
throws
ApiException
Return values
object

EDS API response (or an Error object).

createQSFromArray()

Convert an array of search parameters to EDS API querystring parameters

protected createQSFromArray(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameters to convert to querystring parameters

Return values
array<string|int, mixed>

debug()

Log a debug message.

protected debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

httpRequest()

Perform an HTTP request.

protected abstract httpRequest(string $baseUrl, string $method, string $queryString, array<string|int, mixed> $headers, string $messageBody, string $messageFormat[, bool $cacheable = true ]) : string
Parameters
$baseUrl : string

Base URL for request

$method : string

HTTP method for request (GET, POST, etc.)

$queryString : string

Query string to append to URL

$headers : array<string|int, mixed>

HTTP headers to send

$messageBody : string

Message body to for HTTP Request

$messageFormat : string

Format of request $messageBody and responses

$cacheable : bool = true

Whether the request is cacheable

Return values
string

HTTP response body

log()

Send a message to the logger.

protected log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
$level : string

Log level

$message : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = false

Prepend class name to message?

Return values
void

logError()

Log an error message.

protected logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

logWarning()

Log a warning message.

protected logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

parseAutocomplete()

Parse autocomplete response from API in an array of terms

protected parseAutocomplete(array<string|int, mixed> $msg) : array<string|int, mixed>
Parameters
$msg : array<string|int, mixed>

Response from API

Return values
array<string|int, mixed>

of terms

process()

Process EDS API response message

protected process(string $input) : array<string|int, mixed>
Parameters
$input : string

The raw response from EDS API

Tags
throws
ApiException
Return values
array<string|int, mixed>

The processed response from EDS API

setTokens()

Populate an associative array of session and authentication parameters to send to the EDS API

protected setTokens([string $authenticationToken = null ][, string $sessionToken = null ]) : array<string|int, mixed>
Parameters
$authenticationToken : string = null

Authentication token to add

$sessionToken : string = null

Session token to add

Return values
array<string|int, mixed>

Associative array of header parameters to add.

Search results