Method: addItem

This method makes possible to add an item associated to an order ID.

Authentication

This method does requires authentication.

HTTP method

This method is called with HTTP method GET.

Arguments

Argument Type Element (array) Valid Values Default Value Detail
token string   authenticated session id (stored in the session $_SESSION['token']) required User Token
command string   The order ID required The order ID is provided by createOrder method
item int   The product id required The product id is provided by listProducts method
data array   The attributes of the product required The attributes are provided by listProducts method. These can be: quantity, dimension, orientation, backside, etc.

Returned Values

Element (path) Name Type Description
/ text array
SUCCESS - One product has been added in the command [order ID].  or  ERROR: You have to be authentified to use this method!
/ ID int The item ID

Example Query

	GET http://testapi.wannaprint.com/Rest/1/[API Key]/api/addItem/token=[token]&command=[command]&item=[item]&data%5Bdata1%5D=[data1]&data%5Bdata2%5D=[data2]&data%5Bdata3%5D=[data3]&data%5Bdata4%5D=[data4]

PHP call of method:
	<?php
		session_start();		
		$api_items = $apicaller->sendRequest(array(
					'controller' => 'api',
					'action' =>  'logout',
					'token' =>  $_SESSION['token'],
					'command' =>  $_POST['command'],
					'item' =>  $_POST['item'],
					'data' => array('data1'=>$_POST['data1'],'data2'=>$_POST['data2'],'data3'=>$_POST['data3'],'data4'=>$_POST['data4'])
					)); 
		foreach($api_items->text as $text)
		{
			echo $text;
		}
	?>
   			

Example Response

	{
		"text":["SUCCESS - One product has been added in the command 000000-XZ with ID : 1234."],
		"ID":"1234"
	}

						or

	{
		"text":["ERROR: You have to be authentified to use this method!"]
	}
   			

Error Codes

001: Wrong API Key
The API key is wrong or missing.
002: Failed to parse request
The request could not be parsed.
011: Controller is invalid.
The controller passed is not valid.
031: Invalid Method
This method does not exist in the method list.