NAME
Disbatch::Web::Tasks - Disbatch::Web routes for deprecated task search and creation.
VERSION
version 4.103
DEPRECATION NOTICE
This is deprecated as of Disbatch 4.2 and may be removed in Disbatch 4.4.
NOTE
These routes were formerly in Disbatch::Web, but moved here. They are not loaded by default.
SUBROUTINES
- init($disbatch, $args)
-
Parameters: a
Disbatch::Webobject ($argsis ignored).Sets package global
$disbatch.Returns nothing.
- deserialize_oid($object)
-
Parameters: decoded JSON filter for the search (or a sub-value from it)
If the object has the field
$oid, it is turned into aMongoDB::OIDobject.Returns the modified object.
- search()
-
Parameters: none (but parses request parameters, see
POST /tasks/searchbelow)Performs task search.
Returns result as JSON, setting HTTP status to
400on error.
JSON ROUTES
- POST /tasks/search
-
Parameters:
{ "filter": filter, "options": options, "count": count, "terse": terse }All parameters are optional.
filteris a filter expression (query) object.optionsis an object of desired options to MongoDB::Collection#find.If not set,
options.limitwill be100. This will fail if you try to set it above100.countis a boolean. Instead of an array of task documents, the count of task documents matching the query will be returned.terseis a boolean. Iftrue, the the GridFS id or"[terse mode]"will be returned forstdoutandstderrof each document. Iffalse, the full content ofstdoutandstderrwill be returned. Default istrue.Returns: Array of task Objects or
{ "count": $count }on success;{ "error": "filter and options must be name/value objects" },{ "error": "limit cannot exceed 100" }, or{ "error": "Bad OID passed: $error" }on input error; or{ "error": "$error" }on count or search error.Sets HTTP status to
400on error.Note: replaces /search-tasks-json
- POST /tasks/:queue
-
URL:
:queueis the_idif it matches/\A[0-9a-f]{24}\z/, ornameif it does not.Parameters: an array of task params objects
Returns:
{ ref $res: Object }on success;{ "error": "params must be a JSON array of task params" }or{ "error": "queue not found" }on input error; or{ ref $res: Object, "error": "Unknown error" }on MongoDB error.Sets HTTP status to
400on error.Note: replaces /queue-create-tasks-json
- POST /tasks/:queue/:collection
-
URL:
:queueis the_idif it matches/\A[0-9a-f]{24}\z/, ornameif it does not.:collectionis a MongoDB collection name.Parameters:
{ "filter": filter, "params": params }filteris a filter expression (query) object for the:collectioncollection.paramsis an object of task params. To insert a document value from a query into the params, prefix the desired key name withdocument.as a value.Returns:
{ ref $res: Object }on success;{ "error": "filter and params required and must be name/value objects" }or{ "error": "queue not found" }on input error;{ "error": "Could not iterate on collection $collection: $error" }on query error, or{ ref $res: Object, "error": "Unknown error" }on MongoDB error.Sets HTTP status to
400on error.Note: replaces /queue-create-tasks-from-query-json
SEE ALSO
AUTHORS
Ashley Willis <awillis@synacor.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2016, 2019 by Ashley Willis.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004