When making GET or DELETE request, along the way we are passing next query parameters:
We are getting hash and time from next function:
const hashData = (queryArgs, secretKey) => {
return createHash('sha256').update(`${queryArgs.toString()}:${secretKey}`).digest('hex');
};
export const signGetData = (queryArgs, publicKey, secretKey) => {
queryArgs = new URLSearchParams(queryArgs);
const time = `${Math.floor(Date.now() / 1000)}`;
queryArgs.set('publicKey', publicKey);
queryArgs.set('time', time);
const hash = hashData(queryArgs.toString(), secretKey);
queryArgs.set('hash', hash);
return queryArgs;
};
When making PATCH, POST or PUT request, along the way we are adding next body properties:
And it is also required to pass along in Header:
We are getting hash and time from next function:
const hashData = (data, secretKey) => {
const json = JSON.stringify(data);
return createHash('sha256').update(`${json}:${secretKey}`).digest('hex');
};
export const signPostData = (data, publicKey, secretKey) => {
const time = Math.floor(Date.now() / 1000);
const dataToSign = {
...data,
publicKey,
time
};
const hash = hashData(dataToSign, secretKey);
return { ...dataToSign, hash };
};
Properties
status – ‘pending’ | ‘processing’ | ‘done’ | ‘failed’ | ‘connecting-to-printer’ | ‘archived’ |
Creates a job for a printer with passed parameters.
HTTP Request
POST https://print.bizswoop.app/api/connect-application/v1/jobs
JSON Body
An object with following properties:
type: object | string(JSON) |
Returns
Returns JSON object with following properties:
Possible errors
ERR_INVALID_REQUEST:
{
"errorCode": 'ERR_INVALID_REQUEST',
"message": "Invalid request fields: url, description",
"errors": {
"url": ["Url must be a valid URL"],
"description":["Description is a required field"]
}
}
ERR_JOB_CREATING_PRINT_JOB_LIMIT:
ERR_JOB_CREATING_INVALID_PRINTER_ID:
ERR_SOMETHING_WRONG:
Retrieves a job with a given ID.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/jobs/${ID}
Parameters
Returns
Returns JSON object with following properties:
Possible errors
ERR_ACCESS_FORBIDDEN:
ERR_NOT_FOUND:
ERR_SOMETHING_WRONG:
Return a list of jobs.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/jobs?perPage=10&page=3
Query Parameters
Returns
Returns JSON object with following properties:
In header we are passing as well next properties:
Possible errors
ERR_INVALID_REQUEST:
{
"errorCode": "ERR_INVALID_REQUEST",
"message": "Invalid request fields: page, perPage",
"errors": {
"page": ["Page must be greater than or equal to 1"],
"perPage":["Per Page must be less than or equal to 100"]
}
}
ERR_SOMETHING_WRONG:
Properties
Retrieves a station with a given ID.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/stations/${ID}
Parameters
Returns
Returns JSON object with following properties:
Possible errors
ERR_ACCESS_FORBIDDEN:
ERR_NOT_FOUND:
ERR_SOMETHING_WRONG:
Return a list of stations.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/stations?perPage=1
Query Parameters
Returns
Returns JSON object with following properties:
In header we are passing as well next properties:
Possible errors
ERR_INVALID_REQUEST:
{
"errorCode": "ERR_INVALID_REQUEST",
"message": "Invalid request fields: page",
"errors": {
"page": ["Must be a number"]
}
}
ERR_SOMETHING_WRONG:
Properties
status – ‘online’ | ‘offline’ |
Retrieves a printer with a given ID.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/printers/${ID}
Parameters
Returns
Returns JSON object with following properties:
Possible errors
ERR_ACCESS_FORBIDDEN:
ERR_NOT_FOUND:
ERR_SOMETHING_WRONG:
Return a list of printers.
HTTP Request
GET https://print.bizswoop.app/api/connect-application/v1/printers?perPage=5&page=1
Query Parameters
Returns
Returns JSON object with following properties:
In header we are passing as well next properties:
Possible errors
ERR_INVALID_REQUEST
{
"errorCode": "ERR_INVALID_REQUEST",
"message": "Invalid request fields: perPage",
"errors": {
"perPage": ["Must be a number"]
}
}
ERR_SOMETHING_WRONG :
Typical structure of any error response will be like following:
interface BaseErrorResponse {
errorCode: string;
message: string;
}
Errors codes that might occur for any request: