smartapi-parser
TypeScript icon, indicating that this package has built-in type declarations

1.3.9 • Public • Published

smartapi-parser

Test Coveralls Coverage Status TypeScript npm npm bundle size npm

A NodeJS library for parsing SmartAPI specifications

Install

$ npm install smartapi-parser

Usage

The package requires SmartAPI specification in JSON format as its input. You can use fs or API fetch libraries such as node-fetch, axios to load a SmartAPI file from local or remote desitiniations.

const parser = require('smartapi-parser');
// need to install node-fetch libary first using npm i node-fetch
const fetch = require('node-fetch');

fetch('https://smart-api.info/api/metadata/81955d376a10505c1c69cd06dbda3047')
    .then(response => response.json())
    .then(spec => {
        let api = new parser(spec);
        console.log(api.metadata);
	});
	
	// // {
	// 	"title": "SEMMED Gene API",
	// 	"tags": ["disease", "annotation", "query", "translator", "biothings", "semmed"],
	// 	"url": "https://biothings.ncats.io/semmedgene",
	// 	"operations": [
	// 		"query_operation": ...,
	// 		"association": ...,
	// 		"response_mapping": ...,
	// 		"id": ...
	// 	]
	// // }

Related

Readme

Keywords

Package Sidebar

Install

npm i smartapi-parser

Weekly Downloads

3

Version

1.3.9

License

ISC

Unpacked Size

34.8 kB

Total Files

14

Last publish

Collaborators

  • kevinxin