Updated version 0.1 of Nikita - interface update
Thomas Sødring
thomas.sodring at hioa.no
Tue Jan 31 15:17:21 CET 2017
On 01/31/2017 02:59 PM, Petter Reinholdtsen wrote:
> [Thomas Sødring]
>> I have added some code that now ensures the core publishes the services
>> it supports. This is as per the Noark 5v4 standard and what Petter has
>> been testing.
> Very good!
>
>> Hopefully this is the last thing that has to be done for the 0.1 release
>> and we can now progress with a branch for 0.2. Let me know if you find
>> any problems.
> Recursing over "http://n5test.kxml.no/api/" lead me to
> <URL: http://n5test.kxml.no/api/arkivstruktur/arkiv{?$filter&$orderby&$top&$skip&$search} >
> which return this json document:
>
> {"_links":[{"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/arkiv",
> "href":"http://n5test.kxml.no/api/arkivstruktur/arkiv{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/administrasjon/ny-arkivskaper",
> "href":"http://n5test.kxml.no/api/arkivstruktur/ny-arkivskaper",
> "templated":false},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/arkivskaper",
> "href":"http://n5test.kxml.no/api/arkivstruktur/arkivskaper{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/arkivdel",
> "href":"http://n5test.kxml.no/api/arkivstruktur/arkivdel{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/klassifikasjonssystem",
> "href":"http://n5test.kxml.no/api/arkivstruktur/klassifikasjonssystem{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/klasse",
> "href":"http://n5test.kxml.no/api/arkivstruktur/klasse{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/mappe",
> "href":"http://n5test.kxml.no/api/arkivstruktur/mappe{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/registrering",
> "href":"http://n5test.kxml.no/api/arkivstruktur/registrering{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/basisregistrering",
> "href":"http://n5test.kxml.no/api/arkivstruktur/basisregistrering{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/dokumentbeskrivelse",
> "href":"http://n5test.kxml.no/api/arkivstruktur/dokumentbeskrivelse{?$filter&$orderby&$top&$skip&$search}",
> "templated":true},
> {"rel":"http://rel.kxml.no/noark5/v4/api/arkivstruktur/dokumentobjekt",
> "href":"http://n5test.kxml.no/api/arkivstruktur/dokumentobjekt{?$filter&$orderby&$top&$skip&$search}",
> "templated":true}]}
>
> Doing the same for
> <URL: http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv/ >
> return this json document:
>
> {
> "arkiv" : [ ]
> }
>
> My test is looking for the _links field and fail when it is missing.
> Should it exist, or is it optional?
Just to make sure we are talking about the same thing. The equivalent of
http://n5test.kxml.no/api/
is
http://localhost:8092/noark5v4/hateoas-api/
http://localhost:8092/noark5v4/hateoas-api/ should lead you
http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/
and from here you should be able to get
http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv
http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkivdel
http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/mappe
etc.
I do think that
http://n5test.kxml.no/api/
should lead you to
http://n5test.kxml.no/api/arkivstruktur/
and then from there you can see all the Noark entities.
> Running my test on the latest version show this:
>
> success: found base
> success: correct content-type for base
> success: found _links in json response
> http://localhost:8092/noark5v4/login
> success: able to log in
> recursively discovering URLs from the root
> success: MIME type application/vnd.noark5-v4+json;charset=UTF-8 should be application/vnd.noark5-v4+json for url .
> success: MIME type application/vnd.noark5-v4+json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/
> failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/sakarkiv/
> failure: unable to fetch http://localhost:8092/noark5v4/gui/
> failure: unable to fetch http://localhost:8092/noark5v4/import-api/
> success: MIME type application/vnd.noark5-v4+json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv/
> 7 successes, 3 failures
> Traceback (most recent call last):
> File "./runtest", line 215, in <module>
> main()
> File "./runtest", line 212, in main
> t.runtests()
> File "./runtest", line 205, in runtests
> self.discover()
> File "./runtest", line 96, in discover
> for l in baseref['_links']:
> KeyError: '_links'
>
While the sakarkiv service is official the core should at the moment be
returning a "501 Not implemented" on it and your script should be
ignoring it.
failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/sakarkiv/
These are non-official
failure: unable to fetch http://localhost:8092/noark5v4/gui/
failure: unable to fetch http://localhost:8092/noark5v4/import-api/
so I guess it's OK that they are failing. import-api should be returning
a 501 aswell.
Maybe your script should only be looking for official Noark services.
- Tom
- Tom
More information about the nikita-noark
mailing list