API:Create Quote

From WHMCS Documentation

Jump to: navigation, search

This command is used to create a quote.

Attributes

userid - the unique id number of the client in the tblclients table
firstname - optional - only required if userid is not specified
lastname - optional - only required if userid is not specified
companyname - optional - only required if userid is not specified
email - optional - only required if userid is not specified
address1 - optional - only required if userid is not specified
address2 - optional - only required if userid is not specified
city - optional - only required if userid is not specified
state - optional - only required if userid is not specified
postcode - optional - only required if userid is not specified
country - optional - only required if userid is not specified
phonenumber - optional - only required if userid is not specified
currency - optional - only required if userid is not specified
subject - Subject of the quote
stage - Draft,Delivered,On Hold,Accepted,Lost,Dead
validuntil - In format set in Localisation
datecreated - Optional - In format set in Localisation
customernotes - notes that are viewable by the client
adminnotes - notes that are admin only
lineitems - a base64 encoded serialized array containing:
 desc - The line description
 qty - The quantity being quoted
 up - unit price
 discount - discount amount in %
 taxable - true or false

Example Command

$postfields["action"] = "createquote"; 
$postfields["userid"] = "1";
$postfields["subject"] = "Test Quote Subject";
$postfields["stage"] = "Draft";
$postfields["validuntil"] = "02/02/2011"; 
$lineitem = array();
$lineitem[] = array("desc"=>"Test Description 1","qty"=>1,"up"=>"10.00","discount"=>"10.00","taxable"=>true);
$lineitem[] = array("desc"=>"Test Description 2","qty"=>4,"up"=>"15.00","discount"=>"0.00","taxable"=>true);
$postfields["lineitems"] = base64_encode(serialize($lineitem));

Returned Variables

result - success or error
quoteid - contains the quoteid if successful or the error if not

About the API System · Example API Usage · API Functions

API Functions
Add Client - Update Client - Delete Client - Get Clients - Get Clients Details - Get Clients Products - Get Clients Password - Send Email
Get Support Departments - Get Support Statuses - Get Tickets - Get Ticket - Get Ticket Predefined Cats - Get Ticket Predefined Replies
Open Ticket - Reply Ticket - Add Ticket Note - Delete Ticket
Module Create - Module Suspend - Module Unsuspend - Module Terminate
Create Quote - Update Quote - Delete Quote - Send Quote - Accept Quote
Get Orders - Get Order Statuses - Add Order - Accept Order - Pending Order - Cancel Order - Fraud Order - Delete Order
Get Invoice - Get Payment Methods - Create Invoice - Add Billable Item - Add Invoice Payment
Add Transaction - Add Credit - Capture Payment
Domain WHOIS Lookup - Get Activity Log - Get Admin Details - Update Admin Notes - Get Currencies - Get Email Templates
Get To-Do Items - Get To-Do Item Statuses - Get Staff Online - Get Stats - Encrypt Password - Decrypt Password