For filtering
Hi guys,
we get occasionally in the situation that we need to accept online licence terms, and downloads break off. Movebank has changed their API options and allow accepting licence terms remotely. The question now is whether we want to implement an option accept-licence-terms=T or similar to permit downloading studies where I can see data, but not have accepted the terms manually in the gui yet.
The following code forexample works in R:
library(move) library(tools) cred <- movebankLogin() studyID <- "****" system(paste0('curl -v -u ', paste0(as.vector(cred$headers), collapse=":"), ' -c ./cookies.txt -o ./license_terms.txt "https://www.movebank.org/movebank/service/direct-read?entity_type=event&study_id=1', studyID, '"')) system(paste0('curl -v -u ', paste0(as.vector(cred$headers), collapse=":"), ' -b ./cookies.txt -o ./event_data.txt "https://www.movebank.org/movebank/service/direct-read?entity_type=event&study_id=', studyID, '&license-md5=', md5sum("./license_terms.txt"), '"'))
I guess the key here is to send the "&licence-md5" hash to the gui for the licence_terms.txt file. This could be included in the basic api access functions. The small example above as is, also downloads the event data. So I guess we can do something clever like extending our existing functions, but forst get the licence terms.txt file, if we have not yet accepted, and paste its md5 hashsum into the request we create anyway.
Best, Kami