An open API service indexing awesome lists of open source software.

https://github.com/orcid/orcidsearchurljs

Javascript library that builds a search URL for the ORCID public API.
https://github.com/orcid/orcidsearchurljs

Last synced: 5 months ago
JSON representation

Javascript library that builds a search URL for the ORCID public API.

Awesome Lists containing this project

README

          

orcidSearchUrl.js
=================

Javascript library that builds a search URL for the ORCID public API.

## Functions

* buildUrl(input) Takes a JSON object defining the search, and returns the URL to use in the API.

The input JSON object can have the following properties.


Property
Description


text
The text for a quick search across all fields. Can also be an ORCID iD, in which case only the iD field will be searched.


givenNames
Text to search across the given-names field.


searchOtherNames
Boolean to determine whether to search for givenNames in the other-names field. Default is false.


familyName
Text to search across the family-name field.


keyword
Text to search across the keyword field.


start
The row to start the results from (for paging). Default is 0 (the first row).


rows
The maximum number of results to return.

See orcidSearchUrlSpec.js for examples.

* setBaseUrl(url) Sets the base URL to use. The default is 'https://orcid.org/v1.1/search/orcid-bio/'.

* isValidInput(input) Returns true only if there is some input to search with.

* isValidOrcidId(orcidId) Returns true only if orcidId contains a valid looking ORCID iD URI or path.
Allows preceding and trailing whitespace.

## Using in a browser
Include orcidSearchUrl.js and call ``orcidSearchUrlJs.buildUrl({ text: 'my search terms'})``.

## Using in [Node.js](http://nodejs.org/)
1. Install

npm install orcid-search-url-js

2. Require the module

var orcidSearchUrl = require('orcid-search-url-js');

3. Call

orcidSearchUrlJs.buildUrl({ text: 'my search terms'});


## Contributing

Contributions are welcome.

Please make sure the unit tests (orcidSearchUrlSpec.js) reflect the changes and complete successfully.