API - Version 2‎ > ‎

Codes

The Codes api is how you upload new code to be executed for your tasks.



List Code Packages

GET /2/projects/:project_id/codes

Parameters


In URL:
  • project_id
Headers:
  • Accept : application/json
Required:

Optional:


Request

HTTP GET /2/project/:project_id/codes?oauth=<token>



Response

{
    "codes": [
        {
            "id": "4ea9c05dcddb131f1a000002",
            "Timestamper": {
                "created_at": 1319747677957000000,
                "updated_at": 1319747677957000000
            },
            "project_id": "4ea9c05dcddb131f1a000001",
            "name": "HEREhelloFromPythonFLISEAFNVS",
            "runtime": "python",
            "latest_checksum": "bddaa97ffeaffb36d295511794a7f5fb",
            "rev": 1,
            "latest_history_id": "4ea9c05dcddb131f1a000003"
        }
    ]
}




Create/Upload a Code Package

POST /projects/:project_id/codes

This must be a multipart post containing the parameters below as well as the zip file containing your code package. Click here for more information on how to create a code package.

Parameters


In URL:
  • project_id
Headers:
  • Content-Length :
  • Content-Type : multipart/form-data ; boundary=...
  • Accept-Encoding : gzip/deflate
  • Accept : application/json
  • User-Agent [optional]
Required:
  • name: referenceable (unique) name for your worker.  
  • file: zip file containing code to execute (multipart POST)
  • file_name: file name to execute. This file exists in your zip package.
  • runtime: language/runtime to execute your worker with: ruby, python, javascript.

Optional:



Request

{
    "class_name": "helloFromPythonZKGVOVLHCP",
    "file_name": "hello.py",
    "code_name": "helloFromPythonZKGVOVLHCP",
    "oauth": "jTxYQDmMx5ZtVeZBT8jVx6oJDLw",
    "access_key": "helloFromPythonZKGVOVLHCP",
    "name": "helloFromPythonZKGVOVLHCP",
    "standalone": true,
    "version": "2",
    "timestamp": "Wed Nov  2 14:12:33 2011",
    "runtime": "python",
    "options": {}
}



Response

{
    "msg": "Upload successful.",
    "status_code": 200
}




Get a Code Package

GET /projects/:project_id/codes/:code_id


Parameters


In URL:
  • project_id
  • code_id
Required:

Optional:




Request

HTTP GET /2/projects/4eb1b240cddb13606500000a/codes/4eb1b241cddb13606500000b?oauth=jTxYQDmMx5ZtVeZBT8jVx6oJDLw




Response

{
    "id": "4eb1b241cddb13606500000b",
    "Timestamper": {
        "created_at": 1320268353423000000,
        "updated_at": 1320268353423000000
    },
    "project_id": "4eb1b240cddb13606500000a",
    "name": "helloFromPythonZKGVOVLHCP",
    "runtime": "python",
    "latest_checksum": "bddaa97ffeaffb36d295511794a7f5fb",
    "rev": 1,
    "latest_history_id": "4eb1b241cddb13606500000c"
}



Delete a Code Package

DELETE /projects/:project_id/codes/:code_id


Parameters


In URL:
  • project_id
  • code_id
Required:

Optional:




Request

{
TODO
}




Response

{
TODO
}






TODO: Get zip package
TODO: Code history functions.

Comments