概要

以下の記事で、GakuNin RDMのAPIを用いたアプリケーション構築について紹介しました。

本記事では、GakuNin RDMのAPIを用いて、連携したストレージのファイルを検索する方法を紹介します。

実装例

次のような形で、検索APIを実装しました。なお、https://rdm.nii.ac.jp/api/v1/search/file/にクライアントから直接アクセスした際には、CORSによるエラーが発生したため、Next.jsのAPI Routesとして実装しています。

iiie}mmmxppppcccccccc}c}croooooooooooo;o)oerrrrnnnnnnnnashe}nmh}b;ntttttsUssssssspoil,see,osutRtttttttirgaq}fstta"Adtr{{{aL_thsu,rihdCuynssuqosaapv:ltef}ozroeot:dNagyeruficpaeiiri,meedrnhaNeuenslefzcirr"gcylq}:,s:stoJtexttcsrseeUaschs:tu,:erSaxthSi=yesrmirteeeq}o="niOtROefot=slsoe:a{rru,fP{tzN=Reprunn=Tnareyedf]qalfaO-a.estvne=po==:t"cd:rei,uneswSTtsaspiec=wuaketh:yfe"""""""eaneaTyitwpoortrpre"{{di_{_al_tdjsaarliti"poraonnSiaUlasnh_td{sudaieocllyye,t,eniinsseowR.retvdlstlsltsbhll,zn":ntsesnaLssI=teeelrt:llc^o__etf:ge}si(eenpns::i_"er1ojs_:e`ir.}iGtraItssdc3nf[,^i"locwt"BfejfoEern(e:o"0{gi4p,^bhitcaeyssfrnTgqctus/r,,:e"t1solrhpa(.oro(e.h(rs/:nl,i"^odu(prpjnom}rtuPulira{do,0lcealeas(meSrar.od"m:n.sa,pirrod"fqelrlsnmge^1^ricana"@r:r)a.e?.r:"120dUa$m(tn/ov;msa.nd3_.5.:rt{s)aeamReseraim0a2"1lia);)xper.acci",l",2t,oc,;tp"qSgrhc.,ul,5rnc//nueecPeas""u{/esaeesthascve,,ejsepxss(Prs.er,ssritti"aaTjr:oTv/-)ofrmops3noeaaniask/i0"kruu{(lm.eao,,e"ttatsgnpntn;hhue.e;i:e}/"trgt/x`[;h[e(v2t,.Oft"1:.pu(p/}1.tl"as,2nilpge4eotaea,xneg[rctsxelcoa)t[ihmu;]om/mt"fifeh)ftin]s]lt/e"esat)/.u]"*t"";:h"1O;2p"4t2"i0,o""n0,s"",1;01)0;);

利用例

以下のURLからお試しいただけます。(利用にあたっては、GakuNin RDMへのログインが必要です。)

https://rdm-leaf-editor.vercel.app/search/?q=.xml

これにより、参画しているプロジェクトで連携した複数のストレージに含まれるXMLファイルを横断検索し、それをLEAF Writerのエディタで開く、といったことが可能になりました。

APIは以下です。

https://rdm-leaf-editor.vercel.app/api/search/?filter[fulltext]=.xml

以下のような結果が得られます。

{}"]"}"}""}"r,c,a,tt,te{}o""g""ay"""""""""""isuftgltgppcrutfipgwmmu"""""""""""""""""""""""]"""}""""niosioseroesoinrrieeliddssccmmdgtnnncnnpiien,nch,cfpptlt"ct"Aomgetlseokt"tdaaoorrooeuaoaoaooassxo{}{}ooi"]ooaasea:ea:ljpiraetpuia:s"ttrreeddeigrmrtddr__td,dmgnmlrr""lnlieos"l"irp"d":eettaaiipdsmemeeeerrre""emha"mdee::"{s"[acnt:":ti":a1:____ttff__"a"ag__neea_ii_elm0eenn:e:]ster:un:t."cmfnooiiuu:l:louttgt_cddpnie1nrtt{1s,e"na""tt"a3[6roiorreerriirri_irso""utg".t___,1"1s:ttU"Fi""W"27edld__rrll[z"zyltisaen::bsh:<"nut:""isAio:Gi:daieein__""]e0e""ldtcatl"tb:ari:":oellnrkatf__dain::,d1d::e"rtrr""i:"[>mlt{Pnrle""oi"8einn"mda_._":aecihjc:xne"l}{r""ss:Pu"M4deaa:e"m""txn"":tdhbjd"{mu":e,oC:"R"rp,e7"dmm":e//amaf/"i"_u38:}{ll:"jo,e,"est4:"ee":"wbglmiw"yo:ttaa,<ln:em"sIp"a1:""h":z4s"elzsneo6rf/,"ucpRunr,d6"::j"jv5","ev8"frr""abNlntoelsia02"3Sd"9m::"96:amsl>Ilusngttnt002""aa8Jgp,ggls"s"I,l"eisita02006tau//["/"fs":el,ns"ts"9521"ornf"]0",ae:,Stt,u"0-5.,r"i,,1,l,[tsrt,00-xu,Ol.s"o"ai130mgex"e0r,to0-3lNasm,,1ain91-"aw/lgose92,kao"xen"0T1"a"s,m"s,40T,m,fl,"580us",4:4rt,"4:ao,60"r:4,a4:g40e.4/6.630761d11a058754+170+4001:060:0000"00,"9,00109e0454/",

まとめ

GakuNin RDMが提供するAPIを用いることで、いろいろな応用ができそうだなと感じました。

GakuNin RDMに関わる方々に感謝いたします。