Last edited 6 months ago
by Serena Cericola

ShareDoc:API documentation: Difference between revisions

No edit summary
Tag: 2017 source edit
mNo edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Introduction ==
{{DISPLAYTITLE:Share-VDE APIs}}
{{DISPLAYTITLE:Share-VDE APIs: cross-cutting concepts}}


__TOC__
__TOC__
__FORCETOC__
__FORCETOC__


==Introduction==
Share-VDE manages a complex domain composed by several entities. That results in a complex graph of interconnected entities that can be queried and used by external requestors through a rich set of public APIs. The purpose of this section is to describe what a requestor can do in terms of API in order to interact with Share-VDE.     
Share-VDE manages a complex domain composed by several entities. That results in a complex graph of interconnected entities that can be queried and used by external requestors through a rich set of public APIs. The purpose of this section is to describe what a requestor can do in terms of API in order to interact with Share-VDE.     


We strongly recommend to experiment the Share-VDE API using the [[ShareVDEmembers:TechnicalDocumentation/The PostMan Collection|ready-to-use Postman collection]].       
We strongly recommend to experiment the Share-VDE API using the [[ShareDoc:The PostMan Collection|ready-to-use Postman collection]].       
 
This page offers a high-level overview of the Share-VDE public API, which are detailed in the following two sections:     
 
*[[ShareDoc:GraphQL API|GraphQL API:]] GraphQL<ref>https://graphql.org/</ref> provides a front controller on top of heterogeneous data sources, whether the provider is an API, a database, or an arbitrary application that provides data through an interoperable protocol.
*[[ShareDoc:RESTFul API|REST]]: REST<ref>https://en.wikipedia.org/wiki/Representational_state_transfer</ref> is a software architectural style which focuses on a resource-centric domain model.


==Domain model (diagram)==
==Domain model (diagram)==
Line 16: Line 20:


*'''"functional"''' those entities that are part of the Share-VDE Core Domain Model (e.g. Agents, Opuses, Works, Instances, Items)
*'''"functional"''' those entities that are part of the Share-VDE Core Domain Model (e.g. Agents, Opuses, Works, Instances, Items)
*'''"technical"''' those entities required by some '''technical constraint''' in order to enrich the core entities with additional information (e.g. Collections, Facets, Pagination metadata)
*'''"technical"''' those entities required by some '''technical constraint''' in order to enrich the core entities with additional information (e.g. Collections, Facets, Pagination metadata)
 
 
 
 


<span><br /></span>


<span /><br /><span /><br />
==Common Concepts==
==Common Concepts==
Before going ahead with the API description, it's important to centralise some concepts that are shared between the two available interfaces ([[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]] and [[ShareVDEmembers:APIdoc/RESTFul API|REST]]).
Before going ahead with the API description, it's important to consolidate some concepts that are shared between the two available interfaces ([[ShareDoc:GraphQL API|GraphQL]] and [[ShareDoc:RESTFul API|REST]]).  
===[[ShareVDEmembers:Simple Search|Simple Search]]===
The simple search behaviour is described in this [[ShareVDEmembers:Simple Search|page]].
 
===[[ShareVDEmembers:TechnicalDocumentation/Content Negotiation|Content Negotiation]]===
The content negotiation capabilities have been described in this [[ShareVDEmembers:TechnicalDocumentation/Content Negotiation|page]].


===[[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]]===
*[[ShareDoc:Simple Search|Simple Search:]] How the simple search works in Share-VDE, concepts and common behaviours.
GraphQL<ref>https://graphql.org/</ref> provides a front controller on top of heterogeneous data sources, whether the provider is an API, a database, or an arbitrary application that provides data through an interoperable protocol.


The Share-VDE [[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]] interface is described in detail in this [[ShareVDEmembers:APIdoc/GraphQL API|section]].
*[[ShareDoc:Content Negotiation|Content Negotiation]]: Share-VDE resources are available in several formats, learn how to deal with the different representations.
===[[ShareVDEmembers:APIdoc/RESTFul API|REST]]===
*[[ShareDoc:Query Languages|Query Languages]]: there are multiple query languages available in Share-VDE. This section offers a detailed explanation about them.
REST<ref>https://en.wikipedia.org/wiki/Representational_state_transfer</ref> is a software architectural style which focuses on a resource-centric domain model.  


The Share-VDE [[ShareVDEmembers:APIdoc/RESTFul API|RESTful]] interface is described in detail in this [[ShareVDEmembers:APIdoc/RESTFul API|section]].
The remaining part of this page describes additional details you should be aware before interacting with the API.  
===[[ShareVDEmembers:APIdoc/Query Languages|Query Languages]]===
Share-VDE search API support three different query languages, detailed in this [[ShareVDEmembers:APIdoc/Query Languages|page]].  


===Pagination===
===Pagination===
Line 56: Line 53:
|Integer
|Integer
|The offset of the first item returned in results.
|The offset of the first item returned in results.
|0
| 0
|}
|}
In response, the pagination parameters are returned back, together with a third information called '''totalMatches''', which informs about the total number of entities matching the executed query. Here's an example<syntaxhighlight lang="json">
In response, the pagination parameters are returned back, together with a third information called '''totalMatches''', which informs about the total number of entities matching the executed query. Here's an example<syntaxhighlight lang="json">
Line 70: Line 67:
}
}
</syntaxhighlight>
</syntaxhighlight>
===Sort===
=== Sort===
All operations that return in response a collection of entities accept an optional parameter that allow to sort the (paged) results.
All operations that return in response a collection of entities accept an optional parameter that allow to sort the (paged) results.
{| class="wikitable" style=""
{| class="wikitable" style=""
Line 80: Line 77:
|sort
|sort
|String
|String
|The sort clause (see below)
| The sort clause (see below)
| -----
| -----
|}
|}
Line 106: Line 103:
|-
|-
|'''name'''
|'''name'''
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 119: Line 116:
|-
|-
|'''beginningDate'''
|'''beginningDate'''
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 132: Line 129:
|-
|-
|'''endingDate'''
|'''endingDate'''
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 148: Line 145:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 160: Line 157:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 173: Line 170:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 186: Line 183:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 199: Line 196:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 214: Line 211:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 227: Line 224:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 241: Line 238:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 254: Line 251:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 268: Line 265:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationYear'''
|'''publicationYear'''
Line 281: Line 278:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 308: Line 305:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''form'''
|'''form'''
Line 321: Line 318:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''placeOfOrigin'''
|'''placeOfOrigin'''
Line 334: Line 331:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''format'''
|'''format'''
Line 348: Line 345:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''isbn'''
|'''isbn'''
Line 361: Line 358:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationType'''
|'''publicationType'''
Line 374: Line 371:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationPlace'''
|'''publicationPlace'''
Line 387: Line 384:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="" |
| style="" |
Line 400: Line 397:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''ean'''
|'''ean'''
Line 413: Line 410:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''ismn'''
|'''ismn'''
Line 426: Line 423:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''barcode'''
|'''barcode'''
Line 440: Line 437:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|-
|-
Line 453: Line 450:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|-
|-
Line 479: Line 476:
|
|
|
|
| class="col-green-bg" |
| style="" class="col-green-bg" |
|
|}
|}
====[[ShareVDEmembers:APIdoc/RESTFul API|REST]] Examples====
*sort=name asc
*sort=title desc
*sort=availability asc
====[[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]] Examples====
*sort:"name asc"
*sort:"title desc"
*sort:"availability asc"


===Filters===
===Filters===
All operations that return in response a collection of entities accept in input an optional multivalued parameter (i.e. an array) that allow to apply filters on the results. Specifically:  
All operations that return in response a collection of entities accept in input an optional multivalued parameter (i.e. an array) that allow to apply filters on the results. Specifically:  


*in [[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]] API the parameter is called '''filters''' and it is an array of strings
*in [[ShareDoc:GraphQL API|GraphQL]] API the parameter is called '''filters''' and it is an array of strings
*in [[ShareVDEmembers:APIdoc/RESTFul API|RESTful]] API the parameter is a repeatable request parameter called '''filter'''
* in [[ShareDoc:RESTFul API|RESTful]] API the parameter is a repeatable request parameter called '''filter'''


{| class="wikitable" style=""
{| class="wikitable" style=""
Line 507: Line 491:
!'''Default Value'''
!'''Default Value'''
|-
|-
|filters ([[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]]) / filter ([[ShareVDEmembers:APIdoc/RESTFul API|REST]])
|filters ([[ShareDoc:GraphQL API|GraphQL]]) / filter ([[ShareDoc:RESTFul API|REST]])
|String
|String
|A valid filter clause (see below)
|A valid filter clause (see below)
| -----
| -----
|}A filter clause is composed by 2 parts:
|}A filter clause is composed by 2 parts:


Line 522: Line 506:


*'''multiple clause''' can be specified in '''one filter''': in that case  
*'''multiple clause''' can be specified in '''one filter''': in that case  
**they must refer to the same attribute
** they must refer to the same attribute
**they must be separated using the '''OR''' keyword
**they must be separated using the '''OR''' keyword
**the attribute (and the colon) '''must repeated for each value''' (e.g. year:1982 OR year:2020 OR year:1999)
**the attribute (and the colon) '''must repeated for each value''' (e.g. year:1982 OR year:2020 OR year:1999)
Line 557: Line 541:
|-
|-
|'''beginningDate'''
|'''beginningDate'''
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 570: Line 554:
|-
|-
|'''endingDate'''
|'''endingDate'''
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 586: Line 570:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 598: Line 582:
|  |
|  |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 611: Line 595:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 624: Line 608:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 637: Line 621:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 650: Line 634:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 665: Line 649:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 678: Line 662:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 692: Line 676:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 705: Line 689:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 719: Line 703:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 732: Line 716:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''language'''
|'''language'''
Line 746: Line 730:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''form'''
|'''form'''
Line 759: Line 743:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''subject'''
|'''subject'''
Line 772: Line 756:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''placeOfOrigin'''
|'''placeOfOrigin'''
Line 785: Line 769:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''classification'''
|'''classification'''
Line 798: Line 782:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationPlace'''
|'''publicationPlace'''
Line 812: Line 796:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationYear'''
|'''publicationYear'''
Line 822: Line 806:
|
|
|
|
| class="col-white-bg" |
| style="" class="col-white-bg" |
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''format'''
|'''format'''
Line 838: Line 822:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''isbn'''
|'''isbn'''
Line 851: Line 835:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationType'''
|'''publicationType'''
Line 864: Line 848:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''issn'''
|'''issn'''
Line 877: Line 861:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''printOnline'''
|'''printOnline'''
Line 890: Line 874:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''ean'''
|'''ean'''
Line 903: Line 887:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''ismn'''
|'''ismn'''
Line 916: Line 900:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''barcode'''
|'''barcode'''
Line 930: Line 914:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''holdingInstitution'''
|'''holdingInstitution'''
Line 943: Line 927:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''availability'''
|'''availability'''
Line 969: Line 953:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''contributor'''
|'''contributor'''
Line 979: Line 963:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''printOnlineChoice'''
|'''printOnlineChoice'''
Line 994: Line 978:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''library'''
|'''library'''
Line 1,007: Line 991:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''opusType'''
|'''opusType'''
Line 1,019: Line 1,003:
|
|
|
|
| class="col-orange-bg" style="" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''auctionExhibition'''
|'''auctionExhibition'''
Line 1,033: Line 1,017:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''provenance'''
|'''provenance'''
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''library'''
|'''library'''
Line 1,059: Line 1,043:
|
|
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| class="col-orange-bg" |
| style="" class="col-orange-bg" |
|}
|}


==== "library" and "provenance" filters ====
===="library" and "provenance" filters====
There are two filter attributes that can be used for filtering things belonging to a specific contributor institution: '''library''' and '''provenance'''.  
There are two filter attributes that can be used for filtering things belonging to a specific contributor institution: '''library''' and '''provenance'''.  


* '''library''' is an attribute belonging to items; it is "artificially" copied into the corresponding item owning instance (during the indexing), and as consequence of that, it is available at instance or publication level. The typical usage scenario is when you may want to get back a list of publications (or instances) that have at least one item belonging to a given library/member/provenance.
*'''library''' is an attribute belonging to items; it is "artificially" copied into the corresponding item owning instance (during the indexing), and as consequence of that, it is available at instance or publication level. The typical usage scenario is when you may want to get back a list of publications (or instances) that have at least one item belonging to a given library/member/provenance.
* the '''provenance''' attribute has been introduced in SVDE-8447 (therefore in Share-VDE 3.0.0 and 2.5.0 or higher). It is on every core entity (i.e. Opus, Work, Instance, Item, Agent), it is a multivalued attribute and contains the list of provenances that contributed to a given entity. It can be used  
*the '''provenance''' attribute has been introduced in SVDE-8447 (therefore in Share-VDE 3.0.0 and 2.5.0 or higher). It is on every core entity (i.e. Opus, Work, Instance, Item, Agent), it is a multivalued attribute and contains the list of provenances that contributed to a given entity. It can be used  
** in the [[ShareVDEmembers:APIdoc/RESTFul API/Search API#Stats|/stats]] component, for retrieving '''counts by provenance'''
**in the [[ShareVDEmembers:APIdoc/RESTFul API/Search API#Stats|/stats]] component, for retrieving '''counts by provenance'''
** in contexts (see for example the NATBIB tenant) where there '''are no items''' in the knowledge base. In such a context the "library" attribute it is not available because as said above, it is derived from items.
**in contexts (see for example the NATBIB tenant) where there '''are no items''' in the knowledge base. In such a context the "library" attribute it is not available because as said above, it is derived from items.


====[[ShareVDEmembers:APIdoc/RESTFul API|REST]] Examples====
====[[ShareDoc:RESTFul API|REST]] Examples====
'''Example #1: publications having 1982 as year'''
'''Example #1: publications having 1982 as year'''


Line 1,109: Line 1,093:
filter=publicationYear:1982&filter=language:"<nowiki>https://svde.org/places/28372837</nowiki>"
filter=publicationYear:1982&filter=language:"<nowiki>https://svde.org/places/28372837</nowiki>"


====[[ShareVDEmembers:APIdoc/GraphQL API|GraphQL]] Examples====
====[[ShareDoc:GraphQL API|GraphQL]] Examples====
'''Example #1: publications having 1982 as year'''
'''Example #1: publications having 1982 as year'''


Line 1,146: Line 1,130:
filters:["publicationYear:1982", "language:\"<nowiki>https://svde.org/places/28372837</nowiki>\""]
filters:["publicationYear:1982", "language:\"<nowiki>https://svde.org/places/28372837</nowiki>\""]


{{DEFAULTSORT:Share-VDE APIs}}
{{DEFAULTSORT:Share-VDE APIs: cross-cutting concepts}}
<references />
<references />

Latest revision as of 08:40, 28 May 2024

Introduction


Share-VDE manages a complex domain composed by several entities. That results in a complex graph of interconnected entities that can be queried and used by external requestors through a rich set of public APIs. The purpose of this section is to describe what a requestor can do in terms of API in order to interact with Share-VDE.

We strongly recommend to experiment the Share-VDE API using the ready-to-use Postman collection.

This page offers a high-level overview of the Share-VDE public API, which are detailed in the following two sections:

  • GraphQL API: GraphQL[1] provides a front controller on top of heterogeneous data sources, whether the provider is an API, a database, or an arbitrary application that provides data through an interoperable protocol.
  • REST: REST[2] is a software architectural style which focuses on a resource-centric domain model.

Domain model (diagram)

At the heart of the system there's a complex domain model, as depicted in the following diagram:

Share VDE Domain Model

The domain is composed by functional and technical entities, meaning with that a simple classification where we denote as

  • "functional" those entities that are part of the Share-VDE Core Domain Model (e.g. Agents, Opuses, Works, Instances, Items)
  • "technical" those entities required by some technical constraint in order to enrich the core entities with additional information (e.g. Collections, Facets, Pagination metadata).




Common Concepts

Before going ahead with the API description, it's important to consolidate some concepts that are shared between the two available interfaces (GraphQL and REST).

  • Simple Search: How the simple search works in Share-VDE, concepts and common behaviours.
  • Content Negotiation: Share-VDE resources are available in several formats, learn how to deal with the different representations.
  • Query Languages: there are multiple query languages available in Share-VDE. This section offers a detailed explanation about them.

The remaining part of this page describes additional details you should be aware before interacting with the API.

Pagination

All operations that return in response a collection of entities accept in input two optional parameters that allow to page the results.

Name Type Description Default Value
rows Integer The size of the page of results in the response. 10
offset Integer The offset of the first item returned in results. 0

In response, the pagination parameters are returned back, together with a third information called totalMatches, which informs about the total number of entities matching the executed query. Here's an example

{
  "data": {
    "agents": {
      ...
      "totalMatches": 87,
      "pageSize": 10,
      "startOffset": 0
    }
  }
}

Sort

All operations that return in response a collection of entities accept an optional parameter that allow to sort the (paged) results.

Name Type Description Default Value
sort String The sort clause (see below) -----

The sort clause is composed by 2 parts:

  • a field name: it must be marked as sortable in the Share-VDE dictionary.
  • a sort order: asc (ascending) or desc (descending)

The following matrix lists, for each entity, the attributes available for sorting.

Sortable Attributes Matrix
Contributor Agent Person Meeting Family Organisation Opus Work Instance Item Publication
name
beginningDate
endingDate
location
birthDate
deathDate
birthPlace
deathPlace
startDate
endDate
foundingYear
dissolutionYear
title
publicationYear
genre
language
form
placeOfOrigin
format
isbn
publicationType
publicationPlace
issn
ean
ismn
barcode
holdingInstitution
availability
callNo

Filters

All operations that return in response a collection of entities accept in input an optional multivalued parameter (i.e. an array) that allow to apply filters on the results. Specifically:

  • in GraphQL API the parameter is called filters and it is an array of strings
  • in RESTful API the parameter is a repeatable request parameter called filter
Name Type Description Default Value
filters (GraphQL) / filter (REST) String A valid filter clause (see below) -----

A filter clause is composed by 2 parts:

  • a field name: The list of fields that can be used in a filter clause, for each entity, is provided in the sections that describe the available operations
  • the colon operator :
  • a valid clause: the following rules apply
    • In case of string or URI fields, the clause is the value we want to filter surrounded by double quotes
    • In case of numeric fields the value is just the value we want to use as a filter or a range (see below)

IMPORTANT

  • multiple clause can be specified in one filter: in that case
    • they must refer to the same attribute
    • they must be separated using the OR keyword
    • the attribute (and the colon) must repeated for each value (e.g. year:1982 OR year:2020 OR year:1999)
  • multiple filters (i.e. multiple parameters) are supposed to be executed in AND. That means the result is the global intersection of matching entities between the query and all filters

The following matrix lists, for each entity, the attributes available for filtering.

Filter Attributes Matrix
Contributor Agent Person Meeting Family Organisation Opus Work Instance Item Publication
name
beginningDate
endingDate
location
birthDate
deathDate
birthPlace
deathPlace
occupation
startDate
endDate
foundingYear
dissolutionYear
year
genre
language
form
subject
placeOfOrigin
classification
publicationPlace
publicationYear
format
isbn
publicationType
issn
printOnline
ean
ismn
barcode
holdingInstitution
availability
callNo
contributor
printOnlineChoice
library
opusType
auctionExhibition
provenance
library

"library" and "provenance" filters

There are two filter attributes that can be used for filtering things belonging to a specific contributor institution: library and provenance.

  • library is an attribute belonging to items; it is "artificially" copied into the corresponding item owning instance (during the indexing), and as consequence of that, it is available at instance or publication level. The typical usage scenario is when you may want to get back a list of publications (or instances) that have at least one item belonging to a given library/member/provenance.
  • the provenance attribute has been introduced in SVDE-8447 (therefore in Share-VDE 3.0.0 and 2.5.0 or higher). It is on every core entity (i.e. Opus, Work, Instance, Item, Agent), it is a multivalued attribute and contains the list of provenances that contributed to a given entity. It can be used
    • in the /stats component, for retrieving counts by provenance
    • in contexts (see for example the NATBIB tenant) where there are no items in the knowledge base. In such a context the "library" attribute it is not available because as said above, it is derived from items.

REST Examples

Example #1: publications having 1982 as year

filter=publicationYear:1982

Example #2: publications having year between 1982 and 1999

filter=year:[1982 TO 1999]

Example #3: publications having year up to 1999

filter=year:[* TO 1999]

Example #4: publications having year from 1982

filter=year:[1982 TO *]

Example #5: publications having 1982 or 1999 as year

filter=year:1982 OR year:1999

Example #6: publications having 1982 or in range between 1999 and 2020

filter=year:1982 OR year:[1999 TO 2020]

Example #7: works having a specific language

filter=language:"https://svde.org/languages/ita"

Example #8: works having one or another language

filter=language:"https://svde.org/languages/ita" OR language:"https://svde.org/languages/fre"

Example #9: publications having a specific publication year and published in specific place

filter=publicationYear:1982&filter=language:"https://svde.org/places/28372837"

GraphQL Examples

Example #1: publications having 1982 as year

filters:["publicationYear:1982"]

Example #2: publications having year between 1982 and 1999

filters:["year:[1982 TO 1999]"]

Example #3: publications having year up to 1999

filters:["year:[* TO 1999]"]

Example #4: publications having year from 1982

filters:["year:[1982 TO *]”]

Example #5: publications having 1982 or 1999 as year

filters:["year:1982 OR year:1999"]

Example #6: publications having 1982 or in range between 1999 and 2020

filters:["year:1982 OR year:[1999 TO 2020]"]

Example #7: works having a specific language

filters:["language:\"https://svde.org/languages/ita\""]

Example #8: works having one or another language

filters:["language:\"https://svde.org/languages/ita\" OR language:\"https://svde.org/languages/fre\""]

Example #9: publications having a specific publication year and published in specific place

filters:["publicationYear:1982", "language:\"https://svde.org/places/28372837\""]