This documentation is for developers. You need basic programming knowledge to interact with Metagrid via a REST-like API. We provide the following documentations:
The Metagrid widget is a small snippet of javascript that shows links to additional resources about a person. It’s incorporated on the bibliographic sites of your project and facilitates the technical work of using Metagrid.
Under the hood, the widget queries the following Metagrid endpoint https://api.metagrid.ch/widget/{your-project-slug}/person/{person-identifier}.json and displays the links.
To integrate the Metagrid widget into your project page, you can use one of the following js-modules.
In the following example, we integrate the Metagrid jQuery widget into Dodis. Dodis uses the following URI template to reference persons
https://dodis.ch/P{\d+}. An example is Max Petipierre with the URL https://dodis.ch/P5. Metagrid stores the “5” as the identifier for Petipierre. “Dodis” is the project slug. To query all links in Metagrid about Petitpierre you can use the following query: https://api.metagrid.ch/widget/dodis/person/5.json. We can apply that to our jquery widget
<script src="jquery.js"></script>
<script src="dist/metagrid-client.min.js"></script>
<script>
jQuery(function ($) {
// extract the person-identifier from the URL
var matches = window.location.href.match(/dodis\.ch\/P(\d+)$/);
if(matches !== null){
var id = matches[1];
// call the plugin indirectly
$('#metagridWidget').data({'element-kind':'person', 'element-id': id, 'language': 'de'}).metagridClient({
projectSlug:'dodis'
});
}
});
</script>
<div id="metagridWidget"></div>
This above code extracts the identifier from the current URL and injects it into the jQuery plugin. If there are links for the queried person, it will display them in the #metagridWidget element.