This method does requires authentication.
This method is called with HTTP method GET.
| 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. |
| Element (path) | Name | Type | Description | |||||
|---|---|---|---|---|---|---|---|---|
| / | text | array |
|
|||||
| / | ID | int | The item ID |
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
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;
}
?>
{
"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!"]
}
001: Wrong API Key002: Failed to parse request011: Controller is invalid.031: Invalid Method