Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Set response code blocks to be collapsed by default

...

Code Block
curl -i -k -H Accept:application/json -H Content-Type:application/json -d '{
  "email": "me@myEmail.com",
  "password": "thisIsAFakePassword"
}' https://auth-prod.sagebase.org/auth/v1/session

Response

Expand
title[Click to show]
Code Block
HTTP/1.1 201 Created
Content-Type: application/json
Date: Tue, 28 Aug 2012 23:03:04 GMT
Server: Apache-Coyote/1.1
Content-Length: 43
Connection: keep-alive
{
	"sessionToken":"XXXXXXXXXXXXXXX"
}

 

 


 

Create/Update/Delete Examples

...

Code Block
curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json -d '{"entityType": "org.sagebionetworks.repo.model.Project"}' https://repo-prod.sagebase.org/repo/v1/entity

Response

Expand
title[Click to show]
Code Block
Content-Type: application/json
Date: Wed, 29 Aug 2012 03:34:01 GMT
ETag: 0
Location: /repo/v1/entity/syn1058078
Server: Apache-Coyote/1.1
Content-Length: 396
Connection: keep-alive
{
   "createdOn":"2012-08-29T03:34:00.967Z",
   "id":"syn1058078",
   "parentId":"syn4489",
   "modifiedOn":"2012-08-29T03:34:00.967Z",
   "createdBy":"John Hill",
   "accessControlList":"/repo/v1/entity/syn1058078/acl",
   "etag":"0",
   "modifiedBy":"John Hill",
   "name":"syn1058078",
   "annotations":"/repo/v1/entity/syn1058078/annotations",
   "entityType":"org.sagebionetworks.repo.model.Project",
   "uri":"/repo/v1/entity/syn1058078"
}

 

In the above example, we created an entity with only the 'entityType' but the returned entity had many more fields set.  In the next section we will cover the basic fields of an entity.

...

Code Block
curl -i -k -H sessionToken:YourSessionToken -H ETag:0 -H Accept:application/json -H Content-Type:application/json -X PUT -d '{
   "createdOn":"2012-08-29T03:34:00.967Z",
   "id":"syn1058078",
   "parentId":"syn4489",
   "modifiedOn":"2012-08-29T03:34:00.967Z",
   "createdBy":"John Hill",
   "accessControlList":"/repo/v1/entity/syn1058078/acl",
   "etag":"0",
   "modifiedBy":"John Hill",
   "name":"Example Project",
   "annotations":"/repo/v1/entity/syn1058078/annotations",
   "entityType":"org.sagebionetworks.repo.model.Project",
   "uri":"/repo/v1/entity/syn1058078"
}' https://repo-prod.sagebase.org/repo/v1/entity/syn1058078

Response

Expand
title[Click to show]
Code Block
HTTP/1.1 200 OK
Content-Type: application/json
Date: Wed, 29 Aug 2012 04:16:18 GMT
ETag: 1
Server: Apache-Coyote/1.1
Content-Length: 401
Connection: keep-alive
{
   "createdOn":"2012-08-29T03:34:00.967Z",
   "id":"syn1058078",
   "parentId":"syn4489",
   "modifiedOn":"2012-08-29T04:16:18.234Z",
   "createdBy":"John Hill",
   "accessControlList":"/repo/v1/entity/syn1058078/acl",
   "etag":"1",
   "modifiedBy":"John Hill",
   "name":"Example Project",
   "annotations":"/repo/v1/entity/syn1058078/annotations",
   "entityType":"org.sagebionetworks.repo.model.Project",
   "uri":"/repo/v1/entity/syn1058078"
}


Creating Hierarchy

Hierarchy is created in Synapse by setting the "parentId" field of an entity.  In this example we are going to create a new folder entity as a child to our project:

...