Skip to content

Latest commit

 

History

History
282 lines (237 loc) · 10.7 KB

qbws-api.md

File metadata and controls

282 lines (237 loc) · 10.7 KB

Functions

buildWsdl(wsdlFileLocation)String

Fetches the wsdl file; address location is changed if set in config.

buildRequest()String | Array

Returns an array of sample QBXML requests

parseForVersion(input)String

Parses the first two version components out of the standard four component version number: <Major>.<Minor>.<Release>.<Build>.

serviceLog(data)

Writes a string to the console and log file.

objectNotEmpty(obj)Number

Checks that the type of a variable is 'object' and it is not empty.

announceMethod(name, params)

Logs qbws method calls and their parameters.

serverVersion()String

Communicates the web service's version number to the client.

clientVersion()String

An optional callback that allows the web service to evaluate the current web connector version and react to it.

authenticate()String | Array

Verifies the username and password for the Web Connector that is trying to connect.

sendRequestXML()String

This web method sends the request XML to the client which should process the request within QuickBooks.

closeConnection()String

Called by the Web Connector at the end of a successful update session.

connectionError()String
getInteractiveURL()String
getLastError()String
interactiveDone(wcTicket)String
interactiveRejected()String
receiveResponseXML()Number

This web method facilitates qbws to receive the response XML from QuickBooks via the Web Connector.

## buildWsdl(wsdlFileLocation) ⇒ String Fetches the wsdl file; address location is changed if set in config.

Kind: global function
Summary: If needed, set 'wsdlAddress' within config to build a correct wsdl file. This is likely unecessary if you're not connecting to your web service with a client other than the QuickBooks Web Connector. The Web Connector doesn't seem to care if the address location is incorrect, but connecting using a client created with the soap package does.
Returns: String - The wsdl file.

Param Type Description
wsdlFileLocation String Optional. Defaults to '/qbws.wsdl'.

buildRequest() ⇒ String | Array

Returns an array of sample QBXML requests

Kind: global function
Summary: These QBXML requests are hard coded in to provide examples. This should be replaced with something dynamic.
Returns: String | Array - QBXML requests: CustomerQuery, InvoiceQuery and BillQuery

parseForVersion(input) ⇒ String

Parses the first two version components out of the standard four component version number: <Major>.<Minor>.<Release>.<Build>.

Kind: global function
Returns: String - First two version components (i.e. <Major>.<Minor>) if input matches the regular expression. Otherwise returns input.

Param Type Description
input String A version number.

Example

// returns 2.0
  parseForVersion('2.0.1.30');

serviceLog(data)

Writes a string to the console and log file.

Kind: global function

Param Type Description
data String The information to be logged.

objectNotEmpty(obj) ⇒ Number

Checks that the type of a variable is 'object' and it is not empty.

Kind: global function
Returns: Number - The number of properties in obj, or null if it is not an object.

Param Type Description
obj Object The object to be checked.

announceMethod(name, params)

Logs qbws method calls and their parameters.

Kind: global function

Param Type Description
name String The name of the method.
params Object The parameters sent to the method.

serverVersion() ⇒ String

Communicates the web service's version number to the client.

Kind: global function
Returns: String - qbws's version number

clientVersion() ⇒ String

An optional callback that allows the web service to evaluate the current web connector version and react to it.

Kind: global function
Summary: Not currently required to support backward compatibility but strongly recommended.

Supply one of the following return strings:

  • 'NULL' or '' (empty string) if you want the Web Connector to proceed with the update.
  • 'W:&lt;any text&gt;' if you want the web Connector to display a WARNING dialog prompting the user to continue with the update or cancel it. The text string after the 'W:' will be displayed in the warning dialog.
  • 'E:&lt;any text&gt;' if you want to cancel the update and display an ERROR dialog. The text string after 'E:' will be displayed in the error dialog. The user will have to download a new version of the Web Connector to continue with the update.
  • 'O:&lt;version number&gt;' to tell the user that the server expects a newer version of QBWC than the user currently has but also tells the user which version is needed.

Returns: String - A string telling the Web Connector what to do next.

Param Type Description
args.strVersion String The version of the QB web connector supplied in the web connector's call to clientVersion.

authenticate() ⇒ String | Array

Verifies the username and password for the Web Connector that is trying to connect.

Kind: global function
Summary: The current username and password values are hard-coded for demonstration. You should replace this with your own authentication.
Returns: String | Array - Instructions for QuickBooks to proceed with update.

Possible return values

  • string[0] = ticket
  • string[1]
    • '' (empty string) = use current company file
    • 'none' = no further request/no further action required
    • 'nvu' = not valid user
    • any other string value = use this company file
Param Type
args.strUsername String
args.strPassword String

sendRequestXML() ⇒ String

This web method sends the request XML to the client which should process the request within QuickBooks.

Kind: global function
Returns: String - Returns the request XML for the client to process or an empty string if there are no more requests.

Param Type
args.qbXMLMajorVers Number
args.qbXMLMinorVers Number
args.ticket String
args.strHCPResponse String
args.strCompanyFileName String
args.Country String

closeConnection() ⇒ String

Called by the Web Connector at the end of a successful update session.

Kind: global function

Param Type
args.ticket String

connectionError() ⇒ String

Kind: global function
Returns: String - Returns 'done' if no further action is required by from the client or the company file location.

Param Type Description
args.ticket String A GUID-based ticket string to maintain the identity of the client.
args.hresult String An HRESULT value thrown by QuickBooks when trying to make a connection.
args.message String An error message corresponding to the HRESULT.

getInteractiveURL() ⇒ String

Kind: global function
Returns: String - The URL to the interactive mode website.

Param Type
args.wcTicket String
args.sessionID String

getLastError() ⇒ String

Kind: global function
Returns: String - An error message describing the last web service error.

Param Type
args.ticket String

interactiveDone(wcTicket) ⇒ String

Kind: global function

Param Type
wcTicket String

interactiveRejected() ⇒ String

Kind: global function

Param Type
args.wcTicket String

receiveResponseXML() ⇒ Number

This web method facilitates qbws to receive the response XML from QuickBooks via the Web Connector.

Kind: global function
Returns: Number - The percentage of work done. Must be an integer. Possible values:

  • Greater than 0 - There are more requests to send
  • 100 - Done; no more requests to send
  • Less than 0 - Custom error codes
Param Type
args.ticket String
args.response String
args.hresult String
args.message String