Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertoentringer/lod-opendata
A NPM package for get data of Lëtzebuerger Online Dictionnaire (LOD) from data.public.lu.
https://github.com/robertoentringer/lod-opendata
api data dictionary json-api lod-lu luxembourg luxemburgish open-data package parse public public-api
Last synced: about 5 hours ago
JSON representation
A NPM package for get data of Lëtzebuerger Online Dictionnaire (LOD) from data.public.lu.
- Host: GitHub
- URL: https://github.com/robertoentringer/lod-opendata
- Owner: robertoentringer
- License: mit
- Created: 2019-06-03T20:07:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-18T13:39:29.000Z (over 3 years ago)
- Last Synced: 2024-11-14T15:15:20.441Z (5 days ago)
- Topics: api, data, dictionary, json-api, lod-lu, luxembourg, luxemburgish, open-data, package, parse, public, public-api
- Language: JavaScript
- Homepage: https://npmjs.com/package/lod-opendata
- Size: 271 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lod-opendata
A NPM package for get data of Lëtzebuerger Online Dictionnaire (LOD) from data.public.lu.
Author : [Roberto Entringer](https://robertoentringer.com)
License: MIT
Repo on Github : https://github.com/robertoentringer/lod-opendata
Npm package : https://www.npmjs.com/package/lod-opendata# Installation
```shell
$ npm install lod-opendata
```# Usage
```js
const opendata = require('lod-opendata')// Example with async / Await
const asyncAwait = async () => {
//Get all fields. Use defaults
try {
const result = await opendata()
console.log(result)
} catch (error) {
console.log(error.message)
}
}
asyncAwait()// Example with then / catch
const thenCatch = () => {
//Get all fields. Use defaults
opendata()
.then((obj) => console.log(obj))
.catch((err) => console.log(err.message))//Get all fields from the main `resources` field'
opendata('resources')
.then((obj) => console.log(obj))
.catch((err) => console.log(err.message))//Get the `url` field from `resources` field'
opendata('resources/{url}')
.then(({ resources: [{ url }] }) => console.log(url))
.catch((err) => console.log(err.message))//Get multiple main fields: `page`, `title`, `slug`
opendata('page,title,slug')
.then(({ page, title, slug }) => console.log(page, title, slug))
.catch((err) => console.log(err.message))//Get multiple subfields: `id`, `published`, `latest` from main field `resources`
opendata('resources/{id,published,latest}')
.then(({ resources: [{ id, published, latest }] }) => console.log(id, published, latest))
.catch((err) => console.log(err.message))//Get all fields pass a custom api `url`. Useful if the API URL changes.
const url = 'http://data.public.lu/api/1/datasets/letzebuerger-online-dictionnaire-raw-data'
opendata('', url)
.then((obj) => console.log(obj))
.catch((err) => console.log(err.message))
}
thenCatch()
```See all fields available :
https://data.public.lu/api/1/datasets/letzebuerger-online-dictionnaire/API Documentation - Portail Open Data :
https://data.public.lu/en/docapi/