خدمات الويب
يوفر كوها عددًا من واجهات برمجة التطبيقات التي تتيح الوصول إلى بياناته ووظائفه.
OAI-PMH
بالنسبة لبروتوكول مبادرة الأرشيفات المفتوحة لحصاد الميتاداتا (OAI-PMH) توجد مجموعتين من 'المشاركين': مقدمي البيانات ومقدمي الخدمات. يوفر مقدمي البيانات (الأرشيفات المفتوحة، المستودعات) وصولًا حرًا إلى الميتاداتا، ويمكن، لكن ليس بالضرورة، أن يقوموا بتوفير وصول حر إلى النصوص الكاملة أو غيرها من الموارد. يقدم OAI-PMH طريقة سهلة لتنفيذ حلول منخفضة الحدود لمقدمي البيانات. يستخدم مقدمي الخدمات واجهات OAI لمقدمي البيانات لحصاد وتخزين الميتاداتا. لاحظ أن ذلك يعني عدم وجود طلبات بحث مباشرة إلى مقدمي البيانات، لكن بدلاً من ذلك ترتكز الخدمات على البيانات المحصودة عبر OAI-PMH.
يمكن لكوها أن يعمل في الوقت الحالي كمقدم بيانات فقط. لا يمكنه الحصاد من مستودعات أخرى. إن أكبر عائق أمام حصاد كوها للبيانات من مستودعات أخرى هو أن مارك هو تنسيق الميتاداتا الوحيد الذي يقوم كوها بالفهرسة به. قم بزيارة http://www.oaforum.org/tutorial/english/page3.htm للحصول على رسوم بيانية حول كيفية عمل OAI-PMH.
افتراضيًا، لن يقوم كوها بإدراج معلومات المادة في حزم نتائج OAI-PMH لكن يمكن إضافتها باستخدام خيار include_items في ملف التهيئة المرفق من OAI-PMH:ConfFile.
تعرف على االمزيد حول OAI-PMH من: http://www.openarchives.org/pmh/
لتفعيل OAI-PMH في كوها، قم بتحرير التفضيل OAI-PMH. بمجرد تفعيله يمكنك زيارة http://YOURKOHACATALOG/cgi-bin/koha/oai.pl لرؤية ملفك.
عينة ملف OAI Conf
format:
vs:
metadataPrefix: vs
metadataNamespace: http://veryspecial.tamil.fr/vs/format-pivot/1.1/vs
schema: http://veryspecial.tamil.fr/vs/format-pivot/1.1/vs.xsd
xsl_file: /usr/local/koha/xslt/vs.xsl
marcxml:
metadataPrefix: marxml
metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
include_items: 1
oai_dc:
metadataPrefix: oai_dc
metadataNamespace: http://www.openarchives.org/OAI/2.0/oai_dc/
schema: http://www.openarchives.org/OAI/2.0/oai_dc.xsd
xsl_file: /usr/local/koha/koha-tmpl/intranet-tmpl/xslt/UNIMARCslim2OAIDC.xsl
خادم SRU
يقوم كوها بتنفيذ البحث/الاستعادة عبر بروتوكول URL (SRU). يمكن العثور على المزيد من المعلومات حول البروتوكول نفسه في: http://www.loc.gov/standards/sru/. الإصدار الذي يتم تنفيذه هو الإصدار 1.1.
شرح
إذا أردت الحصول على معلومات حول تنفيذ SRU على خادم معين، يجب عليك الوصول إلى ملف شرح باستخدام طلب إلى الخادم بدون أي ضابط. مثل: http://myserver.com:9999/biblios/. الرد من الخادم هو ملف XML والذي يجب أن يبدو كما يلي، وسيمنحك معلومات حول الإعدادات الافتراضية لخادم SRU.
<zs:explainResponse>
<zs:version>1.1</zs:version>
<zs:record>
<zs:recordSchema>http://explain.z3950.org/dtd/2.0/</zs:recordSchema>
<zs:recordPacking>xml</zs:recordPacking>
<zs:recordData>
<explain xml:base="zebradb/explain-biblios.xml">
<!--
try stylesheet url: http://./?stylesheet=docpath/sru2.xsl
-->
<serverInfo protocol="SRW/SRU/Z39.50">
<host>biblibre</host>
<port>9999</port>
<database>biblios</database>
</serverInfo>
<databaseInfo>
<title lang="en" primary="true">Koha 3 Bibliographic SRU/SRW/Z39.50 server</title>
<description lang="en" primary="true">Koha 3 Bibliographic Server</description>
<links>
<sru>http://biblibre:9999</sru>
</links>
</databaseInfo>
<indexInfo>
<set name="cql" identifier="info:srw/cql-context-set/1/cql-v1.1">
<title>CQL Standard Set</title>
</set>
<index search="true" scan="true" sort="false">
<title lang="en">CQL Server Choice</title>
<map>
<name set="cql">serverChoice</name>
</map>
<map>
<attr type="1" set="bib1">text</attr>
</map>
</index>
<index search="true" scan="true" sort="false">
<title lang="en">CQL All</title>
<map>
<name set="cql">all</name>
</map>
<map>
<attr type="1" set="bib1">text</attr>
</map>
</index>
<!-- Record ID index -->
<index search="true" scan="true" sort="false">
<title lang="en">Record ID</title>
<map>
<name set="rec">id</name>
</map>
<map>
<attr type="1" set="bib1">rec:id</attr>
<attr type="4" set="bib1">3</attr>
</map>
</index>
بحث
يتكون عنوان URL هذا: http://myserver.com:9999/biblios?version=1.1&operation=searchRetrieve&query=reefs من العناصر التالية:
عنوان URL الأساسي لخادم SRU هو: http://myserver.com:9999/biblios?
بحث الحزء بالضوابط الثلاثة المطلوبة: الإصدار، العملية، والاستعلام. يجب أن تكون الضوابط داخل جزء البحث من نموذج key=value، ويمكن جمعهما بعلامة &.
يمكن إضافة ضوابط إضافية إلى الاستعلام، على سبيل المثال: يشير maximumRecords إلى الحد الأقصى لعدد التسجيلات الني يمكن للخادم إعادتها. لذا سيقوم http://myserver.com:9999/biblios?version=1.1&operation=searchRetrieve&query=reefs&maximumRecords=5 بالحصول على أول 5 نتائج من الخادم فقط.
يقدم http://www.loc.gov/standards/sru/sru1-1archive/search-retrieve-operation.html مزيداً من التفاصيل حول عمليات البحث وخاصةً قائمة الضوابط الاختيارية للبحث.
يمكن لمفتاح "العمليات" أن يتخذ قيمتين: scan أو searchRetrieve.
إذا كان operation=searchRetrieve، فيجب أن يكون مفتاح البحث استعلاماً. كما في: operation=searchRetrieve&query=reefs
إذا كان operation=scan، فيجب أن يكون مفتاح البحث scanClause. كما في: operation=scan&scanClause=reefs
يقوم etc/zebradb/biblios/etc/bib1. بتعريف فهارس Zebra/3950 الموجودة في النظام الخاص بك. على سبيل المثال: سترى أن لدينا فهارس عن الموضوع والعنوان: 21 att للموضوع att 4 للعنوان على التوالي.
In the pqf.properties file located under etc/zebradb/pqf.properties I see that an access point already uses my Subject index (index.dc.subject = 1=21) while another uses my Title index (index.dc.title = 1=4) I know this is my Subject index because as I've seen just before in my bib1.att file, it's called with =1=21 in Z3950: so index.dc.subject = 1=21 correctly points to my Subject index. And Title was called with 1=4 so index.dc.title = 1=4 correctly points to my Title index. I can now construct my query just like I would in a search box, just preceding it with the "query" key: query=Subject=reefs and Title=coral searches "reefs" in the subject and "coral" in the title. The full url would be http://myserver.com:9999/biblios?version=1.1&operation=searchRetrieve&query=Subject=reefs and Title=coral If I want to limit the result set to just 5 records, I can do http://myserver.com:9999/biblios?version=1.1&operation=searchRetrieve&query=Subject=reefs and Title=coral&maximumRecords=5
طما يمكني التشغيل بالاقتطاع، أو العلاقات، إلخ. يتم تعريف ذلك في ملف my pqf.properties. يمكنني على سبيل المثال رؤية خصائص الموضع المعرفة كـ:
position.first = 3=1 6=1
# "first in field"
position.any = 3=3 6=1
# "any position in field"
لذلك وعلى سبيل المثال إذا أردت أن يكون "coral" في بداية العنوان، يمكنني القيام بهذا الاستعلام: http://myserver.com:9999/biblios?version=1.1&operation=searchRetrieve&query=Title=coral first
إسترجاع
يقوم بحثي http://univ_lyon3.biblibre.com:9999/biblios?version=1.1&operation=searchRetrieve&query=coral reefs&maximumRecords=1 باسترجاع تسجيلة واحدة فقط. وتبدو الاستجابة هكذا:
<zs:searchRetrieveResponse>
<zs:version>1.1</zs:version>
<zs:numberOfRecords>1</zs:numberOfRecords>
<zs:records>
<zs:record>
<zs:recordPacking>xml</zs:recordPacking>
<zs:recordData>
<record xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd">
<leader> cam a22 4500</leader>
<datafield tag="010" ind1=" " ind2=" ">
<subfield code="a">2-603-01193-6</subfield>
<subfield code="b">rel.</subfield>
<subfield code="d">159 F</subfield>
</datafield>
<datafield tag="020" ind1=" " ind2=" ">
<subfield code="a">FR</subfield>
<subfield code="b">00065351</subfield>
</datafield>
<datafield tag="101" ind1="1" ind2=" ">
<subfield code="c">ita</subfield>
</datafield>
<datafield tag="105" ind1=" " ind2=" ">
<subfield code="a">a z 00|y|</subfield>
</datafield>
<datafield tag="106" ind1=" " ind2=" ">
<subfield code="a">r</subfield>
</datafield>
<datafield tag="100" ind1=" " ind2=" ">
<subfield code="a">20091130 frey50 </subfield>
</datafield>
<datafield tag="200" ind1="1" ind2=" ">
<subfield code="a">Guide des récifs coralliens / A Guide to Coral Reefs</subfield>
<subfield code="b">Texte imprimé</subfield>
<subfield code="e">la faune sous-marine des coraux</subfield>
<subfield code="f">A. et A. Ferrari</subfield>
</datafield>
<datafield tag="210" ind1=" " ind2=" ">
<subfield code="a">Lausanne</subfield>
<subfield code="a">Paris</subfield>
<subfield code="c">Delachaux et Niestlé</subfield>
<subfield code="d">cop. 2000</subfield>
<subfield code="e">impr. en Espagne</subfield>
</datafield>
<datafield tag="215" ind1=" " ind2=" ">
<subfield code="a">287 p.</subfield>
<subfield code="c">ill. en coul., couv. ill. en coul.</subfield>
<subfield code="d">20 cm</subfield>
</datafield>
......
<idzebra>
<size>4725</size>
<localnumber>2</localnumber>
<filename>/tmp/nw10BJv9Pk/upd_biblio/exported_records</filename>
</idzebra>
</record>
</zs:recordData>
<zs:recordPosition>1</zs:recordPosition>
</zs:record>
</zs:records>
</zs:searchRetrieveResponse>
ILS-DI
As of writing, the self documenting ILS-DI is the most complete interface and after it has been enabled as described in the ILS-DI system preferences section the documentation should be available at https://YOURKOHACATALOG/cgi-bin/koha/ilsdi.pl
خدمات تقارير جسون
Koha implements a JSON reports service for every report saved using the Guided Reports Wizard or Report from SQL features.
By default reports will be non-public and only accessible by authenticated users. If a report is explicitly set to public it will be accessible without authentication by anyone. This feature should only be used when the data can be shared safely not containing any patron information.
يمكن الوصول إلى التقارير باستخدام عناوين URL التالية:
تقارير عامة
OpacBaseURL/cgi-bin/koha/svc/report?id=REPORTID
تقارير غير عامة
StaffBaseURL/cgi-bin/koha/svc/report?id=REPORTID
هناك أيضا بعض الضوابط الإضافية متاحة:
بدلاً من الوصول إلى التقرير بواسطة REPORTID يمكنك استخدام اسم التقرير كذلك:
.../cgi-bin/koha/svc/report?name=REPORTNAME
لتسهيل عملية التطوير يوجد أيضاً خيار توليد مخرج مشروح للبيانات. سيتم توليد مصفوفة من علامات الهاش التي تشمل أسماء الحقول كمفاتيح.
.../cgi-bin/koha/svc/report?name=REPORTNAME&annotated=1
جهد واجهة برمجة تطبيقات RESTful ذات إصدار
There is an ongoing effort to converge the APIs above into a single versioned set of modern RESTful endpoints documented using the OpenAPI standard and available by default under https://YOURKOHACATALOG/api/v1/
منح بيانات اعتماد عميل OAuth2
Koha supports the OAuth2 client credentials grant as a means to secure the API for using it from other systems to adhere to current industry standards. More information on the OAuth2 client credentials grant standard can be found here [https://auth0.com/docs/api-auth/grant/client-credentials].
واجهة إدارة مفتاح واجهة برمجة التطبيقات للمستفيدين
In order for API keys to be create for patrons, the system preference RESTOAuth2ClientCredentials must be enabled for the option to appear in a patron record.
التصفح إلى تسجيلة المستفيد واختيار المزيد > إدارة مفاتيح واجهة برمجة التطبيقات
If no API keys exist for a patron there will be a message prompting to generate a client id/secret pair
قم بإدخال وصف لزوج سر/معرف العميل والنقر على حفظ
Koha will generate a client id/secret pair for use to connect to Koha from other third-party systems as an authenticated client
Clicking the Revoke button next to an API credential pair will render the specific credential pair inactive until reactivated
Barcode image generator
Koha provides a barcode image generator on both the staff interface and the public interface. Both require a user to be logged in to use the service, to prevent abuse by third parties.
- For example::
/cgi-bin/koha/svc/barcode?barcode=123456789&type=UPCE
The URL above will generate a barcode image for the barcode "123456789", using the UPCE barcode format.
The available barcode types are: * Code39 * UPCE * UPCA * QRcode * NW7 * Matrix2of5 * ITF * Industrial2of5 * IATA2of5 * EAN8 * EAN13 * COOP2of5
If no type is specified, Code39 will be used.
By default, the barcode image will contain the text of the barcode as well. If this is not desired, the parameter "notext" may be passed to supress this behavior.
- For example::
/cgi-bin/koha/svc/barcode?barcode=123456789¬ext=1
will generate a barcode image 123456789 without the text "123456789" below it.
This service can be used to embed barcode images into slips and notices printed from the browser, and to embed a patron cardnumber into the OPAC, among other possibilities.