Am I testing the wrong URLs?

Thomas Sødring thomas.sodring at hioa.no
Sun Jan 29 17:03:53 CET 2017


Hi,


Thanks for the feedback.  Short answer, No.

This version of the core now requires a JSON payload when creating Noark
entities (fonds, series, file etc.). These payload (request body)
contains information that is specified as mandatory by the standard. So
missing information / payload will result in a "404 Not found" with an
exception description "malformed payload", or something like that.

A working curl example command to create a fonds (arkiv) looks like:

curl  --header Accept:application/vnd.noark5-v4+json --header
Content-Type:application/vnd.noark5-v4+json -X POST -b
/home/tsodring/tmp/cookie.txt --data @./fonds-data.json
http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/ny-arkiv

Payload files e.g fonds-data.json can be found in the following directory :

nikita-noark5-core/core-webapp/src/main/resources/curl

see also

nikita-noark5-core/core-webapp/src/main/resources/curl/import if you
want to set values yourself rather than allowing the core to see it.

If this doesn't solve the problem, can you see if the 404 contains any
more information? But I'm guessing that it is just a missing payload.

Can you cd into nikita-noark5-core/core-webapp/src/main/resources/curl
and run the ./run_curl.sh command to make sure everything is ok?

I will update the project description to reflect this.

 - Thomas

On 01/29/2017 03:13 PM, Petter Reinholdtsen wrote:
> Hi
>
> As I mentioned earlier, I managed to get the updated server up and
> running again, and I started updating my script to test if the server is
> working.  I've modified it to log in and visit various URLs, but this is
> no longer working.  Am I looking at the wrong URLs?
>
> My test script is in https://github.com/petterreinholdtsen/noark5-tester,
> run ./runtest after starting the Nikita server.
>
> When I run it, I get this error:
>
> http://127.0.0.1:8092/noark5v4/login
> http://127.0.0.1:8092/noark5v4/hateoas-api/arkiv
> Traceback (most recent call last):
>   File "./runtest", line 88, in <module>
>     main()
>   File "./runtest", line 85, in main
>     t.runtests()
>   File "./runtest", line 78, in runtests
>     self.testArkiv()
>   File "./runtest", line 69, in testArkiv
>     a = self.json_get("hateoas-api/arkiv")
>   File "./runtest", line 52, in json_get
>     response = self._browser.open(request).read()
>   File "/usr/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 203, in open
>     return self._mech_open(url, data, timeout=timeout)
>   File "/usr/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 255, in _mech_open
>     raise response
> mechanize._response.httperror_seek_wrapper: HTTP Error 404: Not Found
>
> I assume /noark5v4/hateoas-api/arkiv is the wrong path, but what is the
> correct path?  I believe this worked before the rewrite this week, so I
> am unsure what is the cause of the change.
>



More information about the nikita-noark mailing list