Search/Facet
Search/Facet is a service within DiscoverItem that is used to retrieve facets for an active search.
HTTP Method: GET
HTTP Method: POST  
 HTTP Header Content-Type: "application/json" 
HTTP Header User-Agent: ${user-agent}  
 Standard HTTP clients (browser, HTTP client libraries, etc.) will automatically include its User-Agent value.  
Search URL:
https://HOSTNAME/di/search/facet
Search/Facet parameters
| Parameter Name | Definizione | Required/Optional/etc. | Nota | 
|---|---|---|---|
| aid | A valid authorization ID | Required | Refer to authentication service for details. | 
| query | A valid Common Command Language - CCL (ISO 8777) query | Required | Refer to constructing CCL query for details Use the same value for aid and query as used when calling the search service | 
| num | The number of values for each facet | Optional | If not provided, the default value of 15 will be used | 
| name | The facet to retrieve | Optional | If not provided then all facets will be returned Valid values: 
 | 
Example calls
Response
The response from this service is a JSON document.
Successful response request
The following is a sample response for a successful request (HTTP status 200 OK):
{
    "ActiveCatalog":0,
    "Facet":[
        {
            "Name":"author",
            "Entry":[
                {
                    "Value:"Author Name",
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"date",
            "Entry":[
                {
                    "Value":"Publication Date"
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"medium"
            "Entry":[
                {
                    "Value":"Medium"
                    "Frequency":18
                }
            ]
        },
        {
            "Name":"subject",
            "Entry":[
                {
                    "Value":"Subject",
                    "Frequency":0
                }
            ]
        },
        {
            "Name":"catalog",
            "Entry":[
                {
                    "Value":"Catalog Name",
                    "ItemCount":0
                }
            ]
        }
    ]
}                                                                                                                                                                                                                    
Response value glossary
| Value Name | Definizione | 
|---|---|
| ActiveCatalog | An integer value indicating the number of catalogs being actively searched. A value of 0 means that the search is complete. | 
| Facet[n].Entry[n[.Frequency | An integer value indicating the number of items with the same facet value. | 
| Facet["catalog"].Entry[n].ItemCount | An integer value indicating the number of items from that catalog. | 
Unsuccessful response request
The following is a sample response for an unsuccessful request.
{
    "Problem";  {
      "Code":"PUBHG004",
      "Message":"Inactive search"
    }
}        
Problem codes and messages glossary
| HTTP Status | Code | Type | Message | 
|---|---|---|---|
| 400 Bad Request | PUBSC002, PUBHG001 | Public | Missing parameter | 
| 400 Bad Request | PUBSC003 | Public | Invalid parameter | 
| 401 Unauthorized | PUBSC004 | Public | Invalid aid | 
| 401 Unauthorized | PUBSC006 | Public | User group not authorized to access the service | 
| 404 Not Found | PUBHG005 | Public | No result | 
| 412 Precondition Failed | PUBHG004 | Public | Inactive search | 
| 500 Internal Server Error | PRISC001, PRIHG001 | Private | Internal error | 
