retrieve_resource_types

General Purpose

This X-Service enables you to retrieve a list of resource types by institution.

If there is no specific institution include file, the service will return the types from the generic file ./dat01/www_m_eng/type-include. If the generic file does not exist or is empty, the service returns an error message.

Flow

  • login – Called once by the calling application with valid /X user name and password. The session-id retrieved should be passed to all other API calls
  • retrieve_resource_types

Input Parameters

Mandatory

1. SESSION_ID – X(50)

Optional

2. INSTITUTE – X(30)

Explanation of the mandatory and optional parameters:

  • session_id: The session ID is the unique identifier of the login.
  • institute – Default is blank – the service will use the generic resource types list. If specified, the service will look for the institution specific resource list.

Input XML Format

Example 1:

<?xml version = "1.0" encoding = "UTF-8"?>
<x_server_request>
  <retrieve_resource_types_request>
    <institute>METALIB</institute>
    <session_id>TL6HGNJDJ8A93JCAY39U18LCJ5AM3XX1MMAS343RAHC8M5VATM</session_id>
  </retrieve_resource_types_request>
</x_server_request>

Input URL Syntax

MetalibPath:port/X?op=retrieve_resource_types_request&institute=institution code&session_id=Login session id

Example URL Syntax

http://10.1.235.60:8332/X?op=retrieve_resource_types_request&institute=METALIB&session_id=MKR5G7DD5KU3VGSRLVLIHFK178J84P9BCCXRBKQH3SY1QMGI5V

Output XML Format

The XML output includes:

    • institute – The code of the institution as defined in ./vir00/tab_institute.
    • resource_types – The resource types as defined in ./dat01/www_m_eng/type-include[MetaLib:-inst].
      <x_server_response metalib_version="4.00 (20)">
         <retrieve_resource_types_response>
         <institute>METALIB</institute>
         <resource_types>
           <resource_types name="E-Journal" display_name="E-Journal"/>
           <resource_types name="Electronic Book" display_name="Electronic Book"/>
           <resource_types name="Encyclopedia" display_name="Encyclopedia"/>
           <resource_types name="Images" display_name="Images"/>
           <resource_types name="Index" display_name="Index"/>
           <resource_types name="Library" display_name="Library"/>
           <resource_types name="Museum" display_name="Museum"/>
           <resource_types name="Newspaper" display_name="Newspaper"/>
           <resource_types name="Search Engine" display_name="Search Engine"/>
           <resource_types name="Subject Gateway" display_name="Subject Gateway"/>
           <resource_types name="Preprints" display_name="Preprints"/>
         </resource_types>
         <session_id new_session="N">MKR5G7DD5KU3VGSRLVLIHFK178J84P9BCCXRBKQH3SY1QMGI5V</session_id>
        </retrieve_resource_types_response>
      </x_server_response>

Possible Error Codes

1. If the session_id, provided as an input parameter, is not valid, the following error message appears in the XML output:

<error_code>0151</error_code>
<error_text>You are not authorized to use this function</error_text>

This can be caused by not using the session_id returned from the Login X-Service.

2.If this X-Service was activated after the session had timed out:

<error_code>2050</error_code>
<error_text>session timeout</error_text>

3. If one of the parameters is missing:

<error_code>2038</error_code>
<error_text>Missing element from XML request - " verification ".</error_text>

4. If no resources were found for the requested institution:

<error_code>6044</error_code>
<error_text>No resource type for institution '<institute>'</error_text>

5. If the institution does not exist:

<error_code>6025</error_code>
<error_text>Institute '<institute>' does not exist</error_text>

Notes

(Up to metalib_version 4.3.4 (657))

This service has problems with type name and display_name containing non ASCII characters: the characters will be dropped. If you had the type-include file utf8 encoded, they would display correctly but the types would no longer work in the Management inteface (/V is fine)…

Also, the display_name contains a lot spaces around the name which must be stripped.