Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
title[Click to show]

 

 

 

Code Block
HTTP/1.1 201 Created
Content-Type: application/json
Date: Thu, 13 Sep 2012 02:33:06 GMT
ETag: c5dc66a6-c864-4886-a8f1-25c4c84ba48b
Location: /repo/v1/entity/syn1151499
Server: Apache-Coyote/1.1
Content-Length: 620
Connection: keep-alive
{
   "s3Token":"/repo/v1/entity/syn1151499/s3Token",
   "versionLabel":"0.0.0",
   "etag":"c5dc66a6-c864-4886-a8f1-25c4c84ba48b",
   "accessControlList":"/repo/v1/entity/syn1151499/acl",
   "versionUrl":"/repo/v1/entity/syn1151499/version/1",
   "modifiedBy":"John Hill",
   "entityType":"org.sagebionetworks.repo.model.Data",
   "uri":"/repo/v1/entity/syn1151499",
   "id":"syn1151499",
   "createdOn":"2012-09-13T02:33:06.314Z",
   "modifiedOn":"2012-09-13T02:33:06.314Z",
   "parentId":"syn1058078",
   "versions":"/repo/v1/entity/syn1151499/version",
   "createdBy":"John Hill",
   "name":"Sample Data",
   "annotations":"/repo/v1/entity/syn1151499/annotations",
   "versionNumber":1
}

 

 

 


Entity Annotations

Get Annotations

...

Expand
title[Click to show]

 

 

 

Code Block
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 13 Sep 2012 02:38:03 GMT
ETag: c5dc66a6-c864-4886-a8f1-25c4c84ba48b
Server: Apache-Coyote/1.1
Content-Length: 244
Connection: keep-alive
{
   "id":"syn1151499",
   "creationDate":"1347503586314",
   "stringAnnotations":{
   },
   "dateAnnotations":{
   },
   "etag":"c5dc66a6-c864-4886-8f1-25c4c84ba48b",
   "doubleAnnotations":{
   },
   "longAnnotations":{
   },
   "blobAnnotations":{
   },
   "uri":"/entity/syn1151499/annotations"
}

 

 

 


Update Annotations

Then you add new annotations to the existing annotations, or modify the existing annotations, and do a PUT. Note that annotation values must always be arrays even if the array is only of length one.

...

  1. Create an S3 Token.  We will use this token to upload the file to Amazon's S3.
    1. Request

      Code Block
      curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json -d '{"path": "SampleTextFile.txt", "md5":"6b65ca38d3596e0e0e6e1ed3cfa981eb"}' https://repo-prod.sagebase.org/repo/v1/entity/syn1151499/s3Token

      Response

      Expand
      title[Click to show]
      Code Block
      {
         "sessionToken":"AQoDYXdzEG4asAKFXWZXVmnAG7q1zyUzRjVz6rnN6wIRT0msXgSRBC3suTAItfuQjJRv9YOAw3Fr4nlJL2HAnRbNvF1NC4xnW5+j6VUNnJYGtZUj+wii+bTGYncNrruXLxqqLM8Kg/dmGQGWluVZkYy7rLDbofrWcWunRjSYBb7uEe74EURM1jg1ae3qMnNgwBUHWJvJb1AjOojpNujh0N5KX0C3ux6VCDcFrgHR6K+siyfiPqSW25XmabA5jGAnV6EGXn1iazywrl2ZW8z+fYAZB1kgsoTCQgCZMsPxpXxh/BdQi7cc7rwflCr/P1wD51N9PGFakFhJkbm8glGhE+YQDYEOpvRmOF0+S2+xrstIzsEAoZ5NXmMg97pqOWx1sBQVvKp8NXgdkXn422CFJLFPW8u+Vd/HzO6EILnQxYIF",
         "secretAccessKey":"XXXXXXXXXXXXXXXXX",
         "bucket":"proddata.sagebase.org",
         "path":"/1151499/1159148/SampleTextFile.txt",
         "accessKeyId":"XXXXXXXXXXXXXXXXXXXX",
         "md5":"6b65ca38d3596e0e0e6e1ed3cfa981eb",
         "contentType":"text/plain",
         "presignedUrl":"https://s3.amazonaws.com/proddata.sagebase.org/1151499/1159148/SampleTextFile.txt?Expires=1347598777&x-amz-security-token=AQoDYXdzEG4asAKFXWZXVmnAG7q1zyUzRjVz6rnN6wIRT0msXgSRBC3suTAItfuQjJRv9YOAw3Fr4nlJL2HAnRbNvF1NC4xnW5%2Bj6VUNnJYGtZUj%2Bwii%2BbTGYncNrruXLxqqLM8Kg%2FdmGQGWluVZkYy7rLDbofrWcWunRjSYBb7uEe74EURM1jg1ae3qMnNgwBUHWJvJb1AjOojpNujh0N5KX0C3ux6VCDcFrgHR6K%2BsiyfiPqSW25XmabA5jGAnV6EGXn1iazywrl2ZW8z%2BfYAZB1kgsoTCQgCZMsPxpXxh%2FBdQi7cc7rwflCr%2FP1wD51N9PGFakFhJkbm8glGhE%2BYQDYEOpvRmOF0%2BS2%2BxrstIzsEAoZ5NXmMg97pqOWx1sBQVvKp8NXgdkXn422CFJLFPW8u%2BVd%2FHzO6EILnQxYIF&AWSAccessKeyId=ASIAIGRZMDNEEK777KGA&Signature=c%2BC0HOBQ2MOzS4L89ev4OPbzD1w%3D"
      }
  2. Use the "presignedUrl" from the previous step to upload the file to Amazon S3:  Note: For more information on uploading files to S3 see: http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
    1. Request 

      Code Block
      curl -v -k -X PUT -H Content-MD5:a2XKONNZbg4Obh7Tz6mB6w== -H x-amz-acl:bucket-owner-full-control -H Content-Type:text/plain --data-ascii SampleTextFile.txt https://s3.amazonaws.com/proddata.sagebase.org/1151499/1159148/SampleTextFile.txt?Expires=1347598777&x-amz-security-token=AQoDYXdzEG4asAKFXWZXVmnAG7q1zyUzRjVz6rnN6wIRT0msXgSRBC3suTAItfuQjJRv9YOAw3Fr4nlJL2HAnRbNvF1NC4xnW5%2Bj6VUNnJYGtZUj%2Bwii%2BbTGYncNrruXLxqqLM8Kg%2FdmGQGWluVZkYy7rLDbofrWcWunRjSYBb7uEe74EURM1jg1ae3qMnNgwBUHWJvJb1AjOojpNujh0N5KX0C3ux6VCDcFrgHR6K%2BsiyfiPqSW25XmabA5jGAnV6EGXn1iazywrl2ZW8z%2BfYAZB1kgsoTCQgCZMsPxpXxh%2FBdQi7cc7rwflCr%2FP1wD51N9PGFakFhJkbm8glGhE%2BYQDYEOpvRmOF0%2BS2%2BxrstIzsEAoZ5NXmMg97pqOWx1sBQVvKp8NXgdkXn422CFJLFPW8u%2BVd%2FHzO6EILnQxYIF&AWSAccessKeyId=ASIAIGRZMDNEEK777KGA&Signature=c%2BC0HOBQ2MOzS4L89ev4OPbzD1w%3D
      
      
  3. Once the file has been successfully uploaded to S3 update the Entity using the S3 Token:
    1. Request

      Code Block
      curl -i -k -H sessionToken:YourSessionToken -H ETag:2526dd09-565e-4989-b8c4-a82e724672c6 -H Accept:application/json -H Content-Type:application/json -X PUT -d '{
         "s3Token":"/repo/v1/entity/syn1151499/s3Token",
         "versionLabel":"0.0.0",
         "etag":"2526dd09-565e-4989-b8c4-a82e724672c6",
         "accessControlList":"/repo/v1/entity/syn1151499/acl",
         "versionUrl":"/repo/v1/entity/syn1151499/version/1",
         "modifiedBy":"John Hill",
         "contentType":"text/plain",
         "entityType":"org.sagebionetworks.repo.model.Data",
         "uri":"/repo/v1/entity/syn1151499",
         "id":"syn1151499",
         "createdOn":"2012-09-12T19:33:06.314-07:00",
         "modifiedOn":"2012-09-12T19:44:39.544-07:00",
         "parentId":"syn1058078",
         "versions":"/repo/v1/entity/syn1151499/version",
         "createdBy":"John Hill",
         "locations":[
            {
               "path":"/1151499/1158826/SampleTextFile.txt",
               "type":"awss3"
            }
         ],
         "name":"Sample Data",
         "md5":"6b65ca38d3596e0e0e6e1ed3cfa981eb",
         "annotations":"/repo/v1/entity/syn1151499/annotations",
         "versionNumber":1
      }' https://repo-prod.sagebase.org/repo/v1/entity/syn1151499

      Response

       
      Expand
      title[Click to show]

       

       

      Code Block
      HTTP/1.1 200 OK
      Content-Type: application/json
      Date: Thu, 13 Sep 2012 05:10:20 GMT
      ETag: 0bf4af7b-0dc9-4c5c-9454-3931bcf08a17
      Server: Apache-Coyote/1.1
      Content-Length: 1382
      Connection: keep-alive
      {
         "s3Token":"/repo/v1/entity/syn1151499/s3Token",
         "versionLabel":"0.0.0",
         "etag":"0bf4af7b-0dc9-4c5c-9454-3931bcf08a17",
         "accessControlList":"/repo/v1/entity/syn1151499/acl",
         "versionUrl":"/repo/v1/entity/syn1151499/version/1",
         "modifiedBy":"John Hill",
         "contentType":"text/plain",
         "entityType":"org.sagebionetworks.repo.model.Data",
         "uri":"/repo/v1/entity/syn1151499",
         "id":"syn1151499",
         "createdOn":"2012-09-13T02:33:06.314Z",
         "modifiedOn":"2012-09-13T05:12:26.121Z",
         "parentId":"syn1058078",
         "versions":"/repo/v1/entity/syn1151499/version",
         "createdBy":"John Hill",
         "locations":[
            {
               "path":"https://s3.amazonaws.com/proddata.sagebase.org/1151499/1158826/SampleTextFile.txt?Expires=1347599546&x-amz-security-token=AQoDYXdzEG4asAKml38O7Ej08SS50xD7p84phJD9YjcylB6FmjsrDCyGKdb7rpC8GsZloCFT3jd5pVdLDMo58SgDFYNPZjGzg%2BpA6AWk0HTIirwdJvQCdq2KnImv3NMWmvnULs%2B%2Fbbkl6V6C0EPK5W8EhZsCtH55zuOofEpVnNk9BrhhU0VcmStaCevCv6eaCHJw5DsmIsnOlKswGnoibuEAh7WA2JTTU4sg6aDrzYCnDL6MgGxxtnNw7%2B5N9GPmrfLRk7NdqqF2NulYpv%2BH5ZmALdW1YjRAB8C9o9SGPX8nQci1e2r5cGIJyNc6kuw1Fzs0vhRKBH3Jz%2FMR3hdqE7zQmMp5x%2F4eAtgm09GKhPC1kH%2BJdrMFP0i6N%2BmPsQVF4lNx0yhVCwIbC%2BRxYFAIzmiredqAKbvhsOKeILrWxYIF&AWSAccessKeyId=ASIAJNRHQYY4PXQAD3YA&Signature=jtY54hJMHqhWoBiHEsbVIUWipuQ%3D",
               "type":"awss3"
            }
         ],
         "name":"Sample Data",
         "md5":"6b65ca38d3596e0e0e6e1ed3cfa981eb",
         "annotations":"/repo/v1/entity/syn1151499/annotations",
         "versionNumber":1
      }

       

       

       

Versions Create/Read/Update/Delete

...

Expand
title[Click to show]

 

 

 

Code Block
HTTP/1.1 200 OK
Content-Type: application/json
Date: Wed, 05 Oct 2011 16:34:48 GMT
ETag: 0
Server: Apache-Coyote/1.1
Content-Length: 675
Connection: keep-alive

{
  "accessControlList": "/repo/v1/location/17338/acl",
  "annotations": "/repo/v1/location/17338/annotations",
  "contentType": "application/zip",
  "creationDate": 1317832487819,
  "etag": "0",
  "id": "17338",
  "md5sum": "b513a23fc54b7b0d65312e1a900af5a6",
  "name": "17338",
  "parentId": "17337",
  "path": "https://s3.amazonaws.com/stagingdata.sagebase.org/17338/0.0.0/mskcc_prostate_cancer.phenotype.zip?Expires=1317918889&AWSAccessKeyId=AKIAJQBSYCAUPIYF5WTA&Signature=2vTczuWgJ88Z0tiau1%2BPse4L2NA%3D",
  "type": "awss3",
  "uri": "/repo/v1/location/17338",
  "versionComment": null,
  "versionLabel": "0.0.0",
  "versionNumber": 1,
  "versionUrl": "/repo/v1/location/17338/version/1",
  "versions": "/repo/v1/location/17338/version"
}

 

 

 


Create New Version

To create a new version of a location, we set the version comment and label. We also want to set a new path for this version:

...