[Koha-devel] Download a record with curl and Koha API

Thomas Klausner domm at plix.at
Fri Nov 3 17:24:51 CET 2023


Hi!

On Fri, Nov 03, 2023 at 08:38:30AM +0100, Zeno Tajoli via Koha-devel wrote:
> I'm trying to download a record using curl and GET /biblios/{biblio_id}
> With curl I try:
> curl -u user:Pwd --request GET
> 'http://127.0.0.1:8080/api/v1/biblios/xxxx' --header "Content-Type:
> application/json"
> But the answer is:
> ["application\/json","application\/marcxml+xml","application\/marc-in-json","application\/marc","text\/plain"]
> not a json with the MARC21 data.
> What is the error ?

You need to tell the server what format you want via the 'Accept' header:

curl -u user:Pwd --request GET 'http://127.0.0.1:8080/api/v1/biblios/xxxx' --header 'Accept: application/json'

The "content-type" header tell the server the format of the data you're **sending** (but you're not sending anything..)

Greetings,
domm


-- 
Thomas Klausner               domm                  https://domm.plix.at
Just another ( Perl | Postgres | Bicycle | Food | Photo | Vinyl ) Hacker

Moneglia, Italy, via Puck, 2 day exposure
[ 2023-10-14 10:00 > https://domm.plix.at/potd/2023-10-14.html ]

Son #1 release a new very random, very fun game: Mosa Lina
https://store.steampowered.com/app/2477090/Mosa_Lina/
[ 2023-10-24 19:57 > https://domm.plix.at/microblog.html ]


More information about the Koha-devel mailing list