Last edited 2 months ago
by Serena Cericola

ShareDoc:API documentation: Difference between revisions

No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
 
 
 
{{DISPLAYTITLE:Share-VDE APIs}}
{{DISPLAYTITLE:Share-VDE APIs}}


Line 9: Line 5:
__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:       
This page offers a high-level overview of the Share-VDE public API, which are detailed in the following two sections:       


* [[ShareVDEmembers:APIdoc/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: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.
* [[ShareVDEmembers:APIdoc/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.    
*[[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 25: 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>


<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:]] How the simple search works in Share-VDE, concepts and common behaviours
*[[ShareDoc:Simple Search|Simple Search:]] How the simple search works in Share-VDE, concepts and common behaviours.


* [[ShareVDEmembers:TechnicalDocumentation/Content Negotiation|Content Negotiation]]: Share-VDE resources are available in several formats, learn how to deal with the different representations
*[[ShareDoc:Content Negotiation|Content Negotiation]]: Share-VDE resources are available in several formats, learn how to deal with the different representations.
* [[ShareVDEmembers:APIdoc/Query Languages|Query Languages]]: there are multiple query languages available in Share-VDE. This section offers a detailed explanation about them.
*[[ShareDoc:Query Languages|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 other common things you should be aware before interacting with the API.  
The remaining part of this page describes additional details you should be aware before interacting with the API.  


===Pagination===
===Pagination===
Line 57: 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 71: 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 81: Line 77:
|sort
|sort
|String
|String
|The sort clause (see below)
| The sort clause (see below)
| -----
| -----
|}
|}
Line 107: Line 103:
|-
|-
|'''name'''
|'''name'''
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 120: Line 116:
|-
|-
|'''beginningDate'''
|'''beginningDate'''
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 133: Line 129:
|-
|-
|'''endingDate'''
|'''endingDate'''
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 149: Line 145:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 161: Line 157:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 174: Line 170:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 187: Line 183:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 200: Line 196:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 215: Line 211:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 228: Line 224:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 242: Line 238:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 255: Line 251:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 269: Line 265:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationYear'''
|'''publicationYear'''
Line 282: Line 278:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
Line 309: Line 305:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''form'''
|'''form'''
Line 322: Line 318:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''placeOfOrigin'''
|'''placeOfOrigin'''
Line 335: Line 331:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''format'''
|'''format'''
Line 349: Line 345:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''isbn'''
|'''isbn'''
Line 362: Line 358:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationType'''
|'''publicationType'''
Line 375: Line 371:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''publicationPlace'''
|'''publicationPlace'''
Line 388: Line 384:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="" |
| style="" |
Line 401: Line 397:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''ean'''
|'''ean'''
Line 414: Line 410:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''ismn'''
|'''ismn'''
Line 427: Line 423:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|-
|-
|'''barcode'''
|'''barcode'''
Line 441: Line 437:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|-
|-
Line 454: Line 450:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|
|
|-
|-
Line 480: Line 476:
|
|
|
|
| style="background-color:;" class="col-green-bg" |
| style="" class="col-green-bg" |
|}
|}


Line 486: Line 482:
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 495: 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 510: 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 545: Line 541:
|-
|-
|'''beginningDate'''
|'''beginningDate'''
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 558: Line 554:
|-
|-
|'''endingDate'''
|'''endingDate'''
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 574: Line 570:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 586: Line 582:
|  |
|  |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 599: Line 595:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 612: Line 608:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 625: Line 621:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 638: Line 634:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 653: Line 649:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 666: Line 662:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 680: Line 676:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 693: Line 689:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 707: Line 703:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
Line 720: Line 716:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''language'''
|'''language'''
Line 734: Line 730:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''form'''
|'''form'''
Line 747: Line 743:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''subject'''
|'''subject'''
Line 760: Line 756:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''placeOfOrigin'''
|'''placeOfOrigin'''
Line 773: Line 769:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''classification'''
|'''classification'''
Line 786: Line 782:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationPlace'''
|'''publicationPlace'''
Line 800: Line 796:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationYear'''
|'''publicationYear'''
Line 810: Line 806:
|
|
|
|
| style="background-color:;" class="col-white-bg" |
| style="" class="col-white-bg" |
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''format'''
|'''format'''
Line 826: Line 822:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''isbn'''
|'''isbn'''
Line 839: Line 835:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''publicationType'''
|'''publicationType'''
Line 852: Line 848:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''issn'''
|'''issn'''
Line 865: Line 861:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''printOnline'''
|'''printOnline'''
Line 878: Line 874:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''ean'''
|'''ean'''
Line 891: Line 887:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''ismn'''
|'''ismn'''
Line 904: Line 900:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''barcode'''
|'''barcode'''
Line 918: Line 914:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''holdingInstitution'''
|'''holdingInstitution'''
Line 931: Line 927:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''availability'''
|'''availability'''
Line 957: Line 953:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''contributor'''
|'''contributor'''
Line 967: Line 963:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''printOnlineChoice'''
|'''printOnlineChoice'''
Line 982: Line 978:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''library'''
|'''library'''
Line 995: Line 991:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''opusType'''
|'''opusType'''
Line 1,007: Line 1,003:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''auctionExhibition'''
|'''auctionExhibition'''
Line 1,021: Line 1,017:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''provenance'''
|'''provenance'''
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|-
|-
|'''library'''
|'''library'''
Line 1,047: Line 1,043:
|
|
|
|
| style="background-color:;" class="col-orange-bg" |
| style="" class="col-orange-bg" |
|
|
| style="background-color:;" 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,097: 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'''



Latest revision as of 07:57, 21 February 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\""]