Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Descrizione

Questo metodo può essere utilizzato per ottenere la lista e lo stato dei task di rendering attualmente in esecuzione all'interno del sistema.

Utilizzo

I parametri richiesti da questo metodo sono:

  • taskId: Id del task, se impostato a false verranno ritornati tutti i task in esecuzione.

 In caso di successo ritorna un'array di oggetti così strutturati:

  • taskId: Id del task di rendering.
  • statusCode: Codice identificativo dello stato del task.
  • dateCreated: Stringa contenente la data in cui è stato creato il task nel formato YYYY-MM-DD HH:MM:SS.
  • dateUpdated: Stringa contenente la data in cui è stato modificato il task nel formato YYYY-MM-DD HH:MM:SS.

Gestione errori

In caso di errore il metodo genererà un'eccezione che riporterà uno dei seguenti codici di errore:

  • ERROR_INVALID_TASK_ID: Id del task non valido.
  • ERROR_INVALID_TOKEN: Non è stato effettuato nessun login in precedenza o la sessione è scaduta per inutilizzo.
  • ERROR_INVALID_IP: L'indirizzo ip del server che sta effettuando la chiamata non valido perchè non inserito nella whitelist associata alle credenziali.
  • ERROR_SERVER_UNAVAILABLE: Il server non è disponibile o si è verificato un errore di comunicazione generico.

ATTENZIONE

Possibili codici di stato del task

Il campo statusCode può avere i seguenti valori:

  • QUEUED: Il task è stato preso il carico dal sistema è verrà processato non appena si libererà un slot nello spool di rendering.
  • PROCESSING: Il task è in fase di esecuzione.
  • PROCESSED: Il task è stato processato correttamente.
  • ERROR: Il task è stato processato ma è generato un errore.

In .NET è possibile utilizzare la struttura statica renderingStatusCode presente in Structures.

 

PHP
require "vendor/autoload.php"
 
try {
    $ezPrintSDK = new ezPrintSDKWrapper('http://demo.ezprint.it');
	$apiToken = $ezPrintSDK->cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 
	$renderingTasks = $ezPrintSDK->backOffice->bGetRenderingTasks(false);
	
	foreach($renderingTasks as $task) {
		echo $task['taskId'], ' ', $task['statusCode'];
	}
} catch (Exception $e) {
    echo 'Error Code: ',  $e->getMessage();
}

Node.js
try {
	var ezPrintSDK = require('ezprint-sdk-wrapper');
	ezPrintSDK.initializeWrapper('http://demo.ezprint.it');
 
    var apiToken = ezPrintSDK.cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
	var renderingTasks = ezPrintSDK.backOffice.bGetRenderingTasks(false);
 
	renderingTasks.forEach(function(task) {
		console.log(task.taskId);
		console.log(task.statusCode);
	});
} catch (ex) {
	console.log(ex);
}
.NET (C#)
try {
	ezPrintSDKWrapper.Client ezPrintSDK = new ezPrintSDKWrapper.Client("http://demo.ezprint.it");
	ezPrintSDK.cLoginAPI("1WHm0icsupAEm9fil9en","yCHZ0nKiyn1MU0DhpgmG");
	List<ezPrintSDKWrapper.Structures.taskItem> renderingTasks = ezPrintSDK.BackOffice.bGetRenderingTasks(false);
 
	foreach (ezPrintSDKWrapper.Structures.taskItem task in renderingTasks) {
        System.Console.WriteLine("Task{0} processed: {1}", task.taskId, task.statusCode == ezPrintSDKWrapper.Structures.renderingStatusCode.TaskProcessed);
    }
} catch (ezPrintException ex) {
	string ErrorMessage = ex.Message;
}
  • No labels