update_basket_items
This request makes an update of the special API basket together with the details of the final customer.
Call parameters:
Parameter |
Required |
Note |
uid |
yes |
Id client |
pid |
yes |
Id Portal |
lid |
yes |
id Language |
key |
yes |
Authentication code |
api_version |
yes |
API Version |
request |
yes |
Name of request |
items |
yes |
Root of the tree that contains the requests |
id_basket |
yes |
Id of the product received from the request get_brand_items |
qty |
yes |
Qty of the product requested NOTE: qty = 0 means to cancel the line in the basket |
user_id_order |
no |
id order final customer |
user_id_user |
no |
id final customer |
user_company_name |
no |
Personal title (Mr., Ms., etc... ) |
user_first_name |
no |
First name of final customer |
user_last_name |
no |
Last name of final customer |
user_address |
no |
Address of final customer |
user_city |
no |
City of final customer |
user_country |
no |
Country of final customer |
user_zipcode |
no |
ZIP code of final customer |
user_state |
no |
State or Province of final customer |
user_phone |
no |
Telephone of final customer |
user_mobile |
no |
Mobile of final customer |
user_mail |
no |
Email of final customer |
user_retail_price |
no |
Retail price of final customer |
user_discount |
no |
Discount of final customer |
user_price |
no |
Sales price of final customer |
user_cod |
no |
Payment in COD (cod: Cache on Delivery ). Two values are possible:
Default : 0 |
user_note |
no |
Note added from final customer |
internal_note |
no |
Note added from dropshipment partner |
Fields that are not Required are orders placed without additional messages, normal orders.
If a partner wants to use our dropshipping interface the fields that are not Required will be necessary to complete.
Fields messages must be sent encoded in base64 code in order to prevent problems of interpretation in Json structure.
In the event they are not, the API will provide it.
However, these fields (user_note and internet_note) will be based on base64.
Reply parameters:
This result will be devided in two parts:
- General part which determines whether the entire process of data entry into the basket went well
- Details: which shows the outcomes of every request, including the inclusion into the DB. These results will be encapsulated in the parent node "items"
Reply parameters - general part
Parameter |
Always present |
Note |
success |
yes |
true o false, indicates if ALL operations has been executed with succes or not. |
rc |
yes |
return code. |
message |
yes |
Error message |
This part can have the following error messages:
- -2 Access Denied
- -4 Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
- -11 One or more errors occurred while processing your request.
- -14 Unable to proceed. User does not have permission to perform this action
In the situation of error -2 and -4, there will not be present the field 'ITEMS' and also not de details of every single product message.
Reply parameters - detailed part - second part
The outcome of the request with rc = 0 (all ok) or rc = -4 (fatal Error) is shown only with 4 fields:
Parameter |
Always present |
Note |
success |
yes |
true o false, indicates if ALL operations has been executed with succes or not. |
rc |
yes |
return code. |
message |
yes |
Error message |
id_basket |
yes |
Id of API basket |
All the other results will have the following fields:
Parameter |
Always present |
Note |
success |
yes |
true o false, indicates if operation has been executed with succes or not. |
rc |
yes |
return code. |
message |
yes |
Error message |
id_basket |
yes |
Indicated the Id of the API basket |
qty_requested |
yes |
Qty requested |
qty_available |
yes |
New qty available in the warehouse after the modification in the basket |
minimum_qty |
yes |
Qty minimum needed to proceed for the basket. This value can be found in "min_qty" of the function get_brands. |
qty_reserved |
yes |
Qty reserved. This value can be different from qty_requested if:
|
This message are possible if there is an error message:
- -4 Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
- -6 Field {0} si mandatory
- -8 It was not possible to reserve item(s). Minimum quantity is not reached
- -10 The requested quantity is not available in stock. Only {0} item(s) was reserved
- -12 id_basket {0} not found
- -13 Unable to add quantity requested. The product is out of stock
- -20 user_cod must be 0 or 1
Json request structure:
{ "uid": 12345, "pid": 2, "lid": 1, "key": "VtKpudWnzRBioQeBKQXPBdSpamppUTw8", "api_version": "1.0.0", "request": "update_basket_items", "items": [{ "id_basket": 112, "qty": 31, "user_id_order": 22, "user_id_user": 33, "user_company_name": "Ms.", "user_first_name": "Matilda", "user_last_name": "Dale", "user_address": "10 Horner Street", "user_city": "Akron", "user_country": 2, "user_zipcode": "44307", "user_state": "United States", "user_phone": "330-977-0601", "user_mobile": "330-977-0602", "user_mail": "MatildaDale@rhyta.com", "user_retail_price": 1000, "user_discount": 50.3, "user_price": 497, "user_cod": 1, "user_note": "dGVzdG8gY2xpZW50ZQ==", "internal_note": "dGVzdG8gZXNlcmNlbnRl" }, { "id_basket": 22, "qty": 14, "user_id_order": 22, "user_id_user": 33, "user_company_name": "Mr.", "user_first_name": "Arabella", "user_last_name": "Palermo", "user_address": "Bayreuther Strasse 14", "user_city": "Offenbach", "user_country": 3, "user_zipcode": "63073", "user_state": "Germany", "user_phone": "069 82 66 04", "user_mobile": "069 82 66 07", "user_mail": "ArabellaPalermo@dayrep.de", "user_retail_price": 1000, "user_discount": 50.3, "user_price": 497, "user_cod": 0, "user_note": "dGVzdG8gY2xpZW50ZQ==", "internal_note": "dGVzdG8gZXNlcmNlbnRl" }, { "id_basket": 114, "qty": 3, "user_id_order": 22, "user_id_user": 33, "user_company_name": "Intervals s.a.r.l.", "user_first_name": "Melvin", "user_last_name": "Jansson", "user_address": "Avda. Alameda Sundheim, 72", "user_city": "Binaced", "user_country": 5, "user_zipcode": "22510", "user_state": "Spain", "user_phone": "974 313 352", "user_mobile": "974 313 687", "user_mail": "MelvinJansson@jourrapide.com", "user_retail_price": 1000, "user_discount": 50.3, "user_price": 497, "user_cod": 1, "user_note": "dGVzdG8gY2xpZW50ZQ==", "internal_note": "dGVzdG8gZXNlcmNlbnRl" }] } |
Example of php request:
$data = array( "uid" => 12345, "pid" => 2, "lid" => 1, "key" => "VtKpudWnzRBioQeBKQXPBdSpamppUTw8", "api_version" => "1.0.0", "request" => "update_basket_item", "items" => array( array( 'id_basket' => 112, 'qty' => 31, 'user_id_order' => 1, 'user_id_user' => 2, 'user_company_name' => 'Ms', 'user_first_name' => 'Matilda', 'user_last_name' => 'Dale', 'user_address' => '10 Horner Street', 'user_city' => 'Akron', 'user_country' => 1, 'user_zipcode' => '44307', 'user_state' => 'NY', 'user_phone' => '330-977-0601', 'user_mobile' => '330-977-0602', 'user_mail' => 'MatildaDale@rhyta.com', 'user_retail_price' => 1000, 'user_discount' => 50.30, 'user_price' => 497, 'user_cod' => 1, 'user_note' => base64_encode('testo cliente'), 'internal_note' => base64_encode('testo esercente') ) , array( 'id_basket' => 22, 'qty' => 14, 'user_id_order' => 3, 'user_id_user' => 4, 'user_company_name' => 'Mr.', 'user_first_name' => 'Arabella', 'user_last_name' => 'Palermo', 'user_address' => 'Bayreuther Strasse 14', 'user_city' => 'Offenbach', 'user_country' => 2, 'user_zipcode' => '63073', 'user_state' => 'Ge', 'user_phone' => '069 82 66 04', 'user_mobile' => '069 82 66 07', 'user_mail' => 'ArabellaPalermo@dayrep.de', 'user_retail_price' => 1000, 'user_discount' => 50.30, 'user_price' => 497, 'user_cod' => 1, 'user_note' => base64_encode('testo cliente'), 'internal_note' => base64_encode('testo esercente') ), array( 'id_basket' => 114, 'qty' => 3, 'user_id_order' => 5, 'user_id_user' => 6, 'user_company_name' => 'Intervals s.a.r.l.', 'user_first_name' => 'Melvin', 'user_last_name' => 'Jansson', 'user_address' => 'Avda. Alameda Sundheim, 72', 'user_city' => 'Binaced', 'user_country' => 5, 'user_zipcode' => '22510', 'user_state' => '', 'user_phone' => '974 313 352', 'user_mobile' => '974 313 687', 'user_mail' => 'MelvinJansson@jourrapide.com', 'user_retail_price' => 1000, 'user_discount' => 50.30, 'user_price' => 497, 'user_cod' => 1, 'user_note' => base64_encode('testo cliente'), 'internal_note' => base64_encode('testo esercente') ) ) ); $data = array('data' => json_encode($data)); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://dev.dropshippingb2b.com/api/"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $ce = curl_exec($ch); echo $ce; curl_close($ch); |
Example of a positive response:
{ "success": true, "rc": 0, "message": "", "items": [{ "success": true, "rc": 0, "message": "", "id_basket": 112 }, { "success": true, "rc": 0, "message": "", "id_basket": 22 }, { "success": true, "rc": 0, "message": "", "id_basket": 114 }] } |
Some examples of a negative response:
{ "success": false, "rc": -11, "message": "One or more errors occurred while processing your request", "items": [{ "success": true, "rc": 0, "message": "", "id_basket": 3 }, { "success": false, "rc": -12, "message": "id_basket 40 not found. No change has been made", "id_basket": 40 }, { "success": false, "rc": -12, "message": "id_basket 37 not found. No change has been made", "id_basket": 37 }] } |
{ "success": false, "rc": -11, "message": "One or more errors occurred while processing your request", "items": [{ "success": false, "rc": -10, "message": "The requested quantity is not available in stock. Only 11 item(s) was reserved", "id_basket": 3, "qty_requested": 55, "qty_available": "0", "minimum_qty": "0", "qty_reserved": 11 }, { "success": false, "rc": -12, "message": "id_basket 40 not found. No change has been made", "id_basket": 40 }, { "success": false, "rc": -12, "message": "id_basket 37 not found. No change has been made", "id_basket": 37 }] } |
{ "success": false, "rc": -11, "message": "One or more errors occurred while processing your request", "items": [{ "success": true, "rc": 0, "message": "", "id_basket": 3 }, { "success": true, "rc": 0, "message": "", "id_basket": 4 }, { "success": false, "rc": -8, "message": "It was not possible to reserve item(s). Minimum quantity is not reached", "id_basket": 5, "qty_requested": 1, "qty_available": "0", "minimum_qty": "10", "qty_reserved": "14" }] } |
Created with the Personal Edition of HelpNDoc: Free EPub and documentation generator