-
Notifications
You must be signed in to change notification settings - Fork 0
POST worker
tristanls edited this page Nov 24, 2012
·
2 revisions
POST https://api.worker.crxtalk.com/worker
Upload a new worker.
Since Version | 0.2.0 |
---|---|
HTTP method | POST |
Requires login | true |
Content-Type | multipart/form-data; boundary=BOUNDARY |
required Standard multipart Content-Type header must be included |
---|---|---|
crosstalkToken | ausdudsl112347assj2... |
required Authorization token |
None.
Multipart form-data containing "worker" and "package" files.
--BOUNDARY
Content-Disposition: form-data; name="worker"; filename="index.js"
Content-Type: text/plain
...
--BOUNDARY
Content-Disposition: form-data; name="package"; filename="package.json"
Content-Type: application/json
...
--BOUNDARY--
url | https://api.worker.crxtalk.com/worker/my-worker/0.0.2 |
The url to the uploaded worker (notice that it is encoded as WORKER_NAME/VERSION ) |
---|
message | Some error happened |
An error message |
---|
Content-Type: multipart/form-data; boundary=MY_BOUNDARY
crosstalkToken: ausdudsl112347assj2...
--MY_BOUNDARY
Content-Disposition: form-data; name="worker"; filename="index.js"
Content-Type: text/plain
crosstalk.on( "hello", function () {
crosstalk.emit( "world" );
});
--MY_BOUNDARY
Content-Disposition: form-data; name="package"; filename="package.json"
Content-Type: application/json
{
"name": "my-worker",
"description": "Canonical Hello World worker.",
"version": "0.0.2",
"crosstalk": {
"type": "worker"
}
}
201 Created
Location: https://api.worker.crxtalk.com/worker/my-worker/0.0.2
{
"response" : {
"url" : "https://api.worker.crxtalk.com/worker/my-worker/0.0.2"
}
}
400 Bad Request
{ "error" : { "message" : "Some error happened" } }