Actions
Submitting data from a third-party study » History » Revision 2
« Previous |
Revision 2/4
(diff)
| Next »
Tom Clegg, 04/07/2016 07:17 PM
Submitting data from a third-party study¶
As a third-party study (aka third-party collection event), you can add data to a participant's public profile using an HTTP POST request.
POST https://tapestry.example.org/third_party/add_datasetThere are three mandatory form fields:
api_key
is a unique identifier assigned to your study by Tapestry. It is shown on the "view/edit collection event" page.participant_id
is a unique identifier for the participant whose data is being contributed. It is sent to your third-party web site asparticipant_id
when the participant first signs up for your study.data_sources_tsv
is TSV data, where each line looks likemd5_hex <TAB> file_size_decimal <TAB> url [<CR>] <LF>
Tapestry will download the data files from the URLs provided in the TSV data. The files will be added to the participant's profile only if all files are downloaded successfully and the content matches the provided MD5 and file size.
Example:( tmpfile=$(mktemp) printf 'c5b5b2fa19bd66ff23211d9f844e0131\t36868\thttps://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\n' >"$tmpfile" curl -X POST \ --form api_key=9/d5b032dbea658e5289d311a1cdd4a7cba86fae0d \ --form participant_code=85551af2bbc451e66344f27a2cf471994aed64f5 \ --form data_sources_tsv=\<"$tmpfile" \ https://my.pgp-hms.org/third_party/add_dataset echo rm "$tmpfile" )
HTTP/1.1 200 OK {"success":true}
HTTP/1.1 400 Bad Request {"errors":["invalid api_key parameter"]}
Updated by Tom Clegg over 8 years ago · 4 revisions