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_dataset
There 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 as participant_id when the participant first signs up for your study.
  • data_sources_tsv is TSV data, where each line looks like
  • md5_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'
      printf '2f624089c65f12185e79925bc5a7fc42\t121260\thttps://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\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" 
    )
    
Example response:
  • HTTP/1.1 200 OK
    
    {"success":true}
    
If any of the form values are invalid or improperly formatted, the HTTP response will have status 4xx and a JSON body with error details. Example:
  • HTTP/1.1 400 Bad Request
    
    {"errors":["invalid api_key parameter"]}