Job Submission

Top  Previous  Next

To submit a job, use one of these methods.

 

Upload and Submit File

 

Request

 

Use a PUT method to upload a file, and parameters to indicate the target device(s) of the file.

 

Endpoint: /api/putfile

 

Parameters:

targets - semicolon-delimited list of targets, each target format LocID:DevID

title - the name of the file

compid - not needed if using API Key authentication

cmp - 1 if the put content is compressed using zlib (rfc 1950)

props - a line-feed delimited list of name=value pairs to specify properties for the job
(see the output devices API for a list of supported properties)

 

Response

 

A line-feed delimited list of job ID's, one per target.

 

or

 

Error: message

 

See Put an Output Device in the API for Output Devices for a list of valid properties.

 

 

Upload then Submit File

 

This is a two-step process, first to upload the file, then to submit it to target devices.

 

Request 1

 

Use a PUT method to upload a file

 

Endpoint: /api/putfile

 

Parameters: none

 

Response 1

 

A file name to be used in request 2

 

or

 

Error: message

 

Request 2

 

This request can be repeated to submit the same file with different parameters.

 

Endpoint: /api/submitfile

 

Parameters:

file - the file name returned from response 1

targets - semicolon-delimited list of targets, each target format LocID:DevID

title - the name of the file

compid - not needed if using API Key authentication

cmp - 1 if the content is compressed using zlib (rfc 1950), or 2 if gzip (rfc 1952)

props - a line-feed or semicolon delimited list of name=value pairs to specify properties for the job

 

Response 2

 

A line-feed delimited list of job ID's, one per target.

 

or

 

Error: message

 

See Put an Output Device in the API for Output Devices for a list of valid properties.

 

Upload Segments, then Submit File

 

This method is preferred for large files exceeding 500k to limit impact on network resources and to allow for fault tolerance during submission of those large files.

 

Request 1

 

Obtain a temporary file to upload segments to.

 

Endpoint: /api/tempfile

 

Parameters: none

 

Response 1

 

A file name

 

or

 

Error: message

 

Request 2

 

Use the PUT method to upload segments of the file.  This must be repeated until all bytes of the file have been uploaded.  If the file to be uploaded should be compressed, zlib compression should be applied to the whole file rather than individual segments, and the resulting compressed data uploaded, then when submitting the file, indicate it is compressed.

 

Endpoint: /api/putsegment

 

Parameters:

file - the file name returned in response 1

index - the byte position (0-based) of this segment, note when using compression, this is the index within the compressed data

 

Response 2

 

The number of bytes written, which should match the content length of the PUT data

 

or

 

Error: message

 

 

Request 3

 

Finally, submit the file.

 

Endpoint: /api/submitfile

 

Parameters:

file - the file name returned from response 1

targets - semicolon-delimited list of targets, each target format LocID:DevID

title - the name of the file

compid - not needed if using API Key authentication

cmp - 1 if the content is compressed using zlib (rfc 1950), or 2 if gzip (rfc 1952)

props - a line-feed delimited list of name=value pairs to specify properties for the job

 

Response 2

 

A line-feed delimited list of job ID's, one per target.

 

or

 

Error: message

 

See Put an Output Device in the API for Output Devices for a list of valid properties.

 

 

Job Status

 

Use this endpoint to check the status of a job that has been submitted.

 

Request

 

Endpoint: /api/get/job/CompID/LocID/DevID/JobID

 

Parameters: none

 

Response

 

A JSON object with these fields:

 

Name - the file name or title of job

Submitted - submitted time

Size - size in bytes

MimeType

Ext - file extension

State - 0=submitted, 1=received at client, 2-delivered, 3-deleted, 8-saved, 9-trashed (8 and 9 are for browser users)

Data - null

Segments - integet array, internal use

SrcID

LocID

DevID

Properties - object of job properties the job was submitted with

RawPrint - true|false, true if raw print rather than driver print

Target - the output device target, as delivered, after any tag substitutions

Received - time received by client

Delivered - time delivered by client

Message - status or error message reported by client

Updated - integer time stamp of last server update of job