Parameters skipped when calling API with curl

I try to use a script o get DOIs for a list of references. In addition to “query dot bibliographic”, I try to use “rows=2”, “select=title” and “mailto”. The script communicates with api dot crossref dot org via curl and sends one query string. My query is URI-encoded.
It seems, only the first parameter of the query string is used by the server. When I use “query dot bibliographic” as the firs parameter, I get the correct reference as the firs one, but all records for 20 references. When I use “rows=2” as the first parameter, I get two references unrelated to my (intended) query.
Strangely, when I copy and paste the respective URL into my browser, I do get the correct result (only 2 references, only titles, the queried one on top).

Gunther Maier

The problem is solved. It is actually not a server-problem but a curl-problem. Curl interprets the & characters in the url as separators of commands. All I had to do is o enclose the url with the parameters in quotes.

Gunther Maier

1 Like

Thank you for letting us know @gunthermaier and for also sharing the resolution.

If you have more issues then please do post again.