Skip to content

Instantly share code, notes, and snippets.

@miku
Last active December 4, 2019 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/46b6fbdec1b6ad6b1941426e3997a934 to your computer and use it in GitHub Desktop.
Save miku/46b6fbdec1b6ad6b1941426e3997a934 to your computer and use it in GitHub Desktop.
Trying to reproduce a HTTP 400 on datacite api v2 using cursor.
#!/bin/bash
# To reproduce, run script and wait a bit, until it stop; last line should be a
# (22) from curl.
#
# $ bash cursor400.sh
# ...
# curl: (22) The requested URL returned error: 400
set -eu -o pipefail
CURSOR=1
while true; do
echo $CURSOR
CURSOR=$(curl --fail -v "https://api.datacite.org/dois?page%5Bsize%5D=50&page%5Bcursor%5D=$CURSOR&query=updated%3A%5B2019-11-20T00%3A00%3A00.000Z+TO+2019-11-20T23%3A59%3A59.000Z%5D" |
jq -r .links.next | grep -Eo '[a-zA-Z0-9_-]{36,}')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment