Skip to content

WorkspaceFile REST API

Chris Churas edited this page May 7, 2015 · 36 revisions
Call Example URL
Get a list of Workspace Files /rest/workspacefiles
/rest/workspacefiles?synced=true&owner=bob
Get a Workspace File /rest/workspacefiles/1234
Create WorkspaceFile /rest/workspacefiles
Update WorkspaceFile /rest/workspacefiles/1234?size=2222
Delete a WorkspaceFile /rest/workspacefiles/1234

Get a list of Workspace Files

Obtains a list of WorkspaceFiles in Json format.

Method: GET
Path: /rest/workspacefiles?synced=[]&owner=[]&sourcejobid=[]&isfailed=[]&type=[]
Content-Type: application/json
Query Parameters:
  • synced If set to true returns only WorkspaceFiles that have been synchronized to cluster (valid values true|false)
  • owner Returns only files owned by that user
  • isfailed If set to true only returns WorkspaceFiles whose Jobs have failed. If false only WorkspaceFiles whose Jobs succeeded. If calling to populate WorkspaceFiles for parameter input, set isfailed to false if allowFailedWorkspaceFile parameter in json is false otherwise omit this query parameter.
  • type If set restricts WorkspaceFiles returned to those with types in comma delimited list passed in. If calling to populate WorkspaceFiles then set this value with the non null value from allowedWorkspaceFileTypes in json.
Return: Json representation of WorkspaceFiles Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X GET \
https://crbsworkflow.appspot.com/rest/workspacefiles?synced=true

Get a Workspace File

Obtains a single WorkspaceFile in Json format. An optional parameter causes inclusion of upload URL that can be used to a upload a file, see Query Parameters below.

Method: GET
Path: /rest/workspacefiles/<WORKSPACEFILE ID>?adduploadurl=[]
Content-Type: application/json
Query Parameters:
  • adduploadurl Set to true will result in uploadurl to be set in resulting Json which can be POSTED to for file upload
Return: Json representation of WorkspaceFile Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X GET \
https://crbsworkflow.appspot.com/rest/workspacefiles/1?adduploadurl=true

Create WorkspaceFile

Creates a new WorkspaceFile. Upon success a Json representation of the WorkspaceFile is returned with id set and depending on query parameters set the uploadURL is also set. The caller can then post the file to this url setting the id to workspace id. See for example

Method: POST
Path: /rest/workspacefile?adduploadurl=[]
Content-Type: application/json
Content:

Json representation of WorkspaceFile. If create date is not set it is set to time of insert. The id is ignored at present

Return: Json representation of WorkspaceFile with id set Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X POST -H "Content-Type: application/json" \
-d '{"createDate" : null,"description" : "text about file","blobKey" : null,"md5" : null,"deleted" : false, "dir" : false, "sourceJobId" : null, "uploadURL" : null, "owner" : "bob", "id" : null, "type" : "png", "path" : null, "name" : "foo.png", "size" : 123123}' https://crbsworkflow.appspot.com/rest/workspacefiles

Update WorkspaceFile

Updates an existing WorkspaceFile. At the moment update lets caller update the path via a query parameter

Method: POST
Path: /rest/workspacefiles/<WORKSPACEFILE_ID>?path=[]&size=[]&isfailed=[]&deleted=[]
Content-Type: application/json
Content:

None

Query Parameters:
  • path Set to path where file resides on cluster or null if file is not synchronized
  • size Set to size of file or directory on cluster in bytes
  • isfailed Set to true if WorkspaceFile is from a failed Job otherwise false or omit.
  • deleted Set to true to set delete or false to undelete or omit to not touch it.
Return: Json representation of WorkspaceFile with path Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X POST -H "Content-Type: application/json" \
-d '{}' https://crbsworkflow.appspot.com/rest/workspacefiles/1?path=%2Fhome%2Ffoo%2Ffoo.png&size=5345345

Delete a WorkspaceFile

Deletes a WorkspaceFile. Default operation is to perform a logical delete where deleted field is set to true. This method will return Json denoting outcome of operation. A WorkspaceFile can only be deleted if no Jobs are using it for input and if its not output of an existing Job.

Method: DELETE
Path: /rest/workspacefiles/<WORKSPACEFILE ID>?permanentlydelete=[]
Query Parameters:
  • permanentlydelete If set to true then delete will completely remove WorkspaceFile from system, otherwise a logical delete will be performed if unset or false
Content-Type: application/json
Return: Json representation of a DeleteReport Example return
Error: Returns 500 Internal Service Error

Example Curl call:

curl -X DELETE \ 
https://crbsworkflow.appspot.com/rest/workspacefiles/12345
Clone this wiki locally