This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Documents in SalesBinder



Overview

The following operations allow you to work with documents. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with documents, see Sample configuration

OperationDescription

createDocument

Creates a new document.

getDocumentByIdRetrieves document details.
listDocumentsRetrieves all documents.
updateDocumentUpdates a document.

Operation details

This section provides further details on the operations related to documents.

Creates a new document

The createDocument operation creates a new document.

createDocument
 <salesbinder.createDocument>
    <contextId>{$ctx:contextId}</contextId>
    <totalCost>{$ctx:totalCost}</totalCost>
    <customerId>{$ctx:customerId}</customerId>
    <totalTax2>{$ctx:totalTax2}</totalTax2>
    <documentsItem>{$ctx:documentsItem}</documentsItem>
    <issueDate>{$ctx:issueDate}</issueDate>
    <totalTax>{$ctx:totalTax}</totalTax>
    <dropShipCustomerId>{$ctx:dropShipCustomerId}</dropShipCustomerId>
    <shippingAddress>{$ctx:shippingAddress}</shippingAddress>
	<totalPrice>{$ctx:totalPrice}</totalPrice>
</salesbinder.createDocument>
Properties
  • contextId: The ID of the context.
  • totalCost: The total amount of the cost.
  • customerId: The ID of the customer.
  • totalTax2: The total amount of the tax2.
  • documentsItem: The array of the documents item.
  • issueDate: The date of issue.
  • totalTax: The total amount of the tax.
  • dropShipCustomerId: The customer ID for the drop ship.
  • shippingAddress: The shipping address.
  • totalPrice: The total value of the price.
Sample request

Following is a sample REST/JSON request that can be handled by the createDocument operation.

Sample Request for createDocument
{
    "apiUrl": "https://sblsoft.salesbinder.com",
    "apiKey": "cb2192d4832db952ac5d0ec9f41770e88c733c0f",
    "contextId": "11",
    "totalCost": "1000.00",
    "customerId": "54d35e07-d974-4401-9152-065a0ad26590",
    "totalTax": "98.00",
    "totalTax2": "70.00",
    "issueDate": "2013-06-02",
    "dropShipCustomerId": "54d35e07-d974-4401-9152-065a0ad26590",
    "shippingAddress": "(Same as above)",
    "totalPrice": "1400.00",
    "documentsItem": [
        {
            "item_id": "54d35f54-d774-40cd-a958-04be0ad26590",
            "unit_id": 1,
            "description": "Our latest and greatest product!",
            "quantity": "2.00",
            "tax": "7.00",
            "tax2": "5.00",
            "cost": "1000.00",
            "price": "1400.00"
        }
    ]
}
Related SalesBinder documentation

http://www.salesbinder.com/kb/api-functions/create-new-document/

Retrieving document details by ID

The getDocumentById operation retrieves document details by ID. 

getDocumentById
<salesbinder.getDocumentById>
	<id>{$ctx:id}</id>
</salesbinder.getDocumentById>
Properties
  • id: Required - The ID of the document.
Sample request

Following is a sample REST/JSON request that can be handled by the getDocumentById operation.

Sample Request for getDocumentbyId
{
	"apiUrl":"https://sblsoft.salesbinder.com",
	"apiKey":"cb2192d4832db952ac5d0ec9f41770e88c733c0f",
	"id":"54d9af5b-5640-4a27-8fc4-42b50ad26590"
}
Related SalesBinder documentation

http://www.salesbinder.com/kb/api-functions/view-document-details/

Retrieving all documents

The listDocuments operation retrieves all documents. 

listDocuments
<salesbinder.listDocuments>
    <contextId>{$ctx:contextId}</contextId>
	<page>{$ctx:page}</page>
</salesbinder.listDocuments>
Properties
  • contextId: The context ID of the document.
  • page: The number of pages of documents.
Sample request

Following is a sample REST/JSON request that can be handled by the listDocuments operation.

Sample Request for listDocuments
{
	"apiUrl":"https://sblsoft.salesbinder.com",
	"apiKey":"cb2192d4832db952ac5d0ec9f41770e88c733c0f",
	"contextId":"11"
}

Note

There are optional parameters available. For more information on the usage of these parameters please check the API document. 

Related SalesBinder documentation

http://www.salesbinder.com/kb/api-functions/list-documents/

Updating an existing document

The updateDocument operation updates an existing document.

updateDocument
<salesbinder.updateDocument>
    <id>{$ctx:id}</id>
    <contextId>{$ctx:contextId}</contextId>
    <totalCost>{$ctx:totalCost}</totalCost>
    <customerId>{$ctx:customerId}</customerId>
    <totalTax2>{$ctx:totalTax2}</totalTax2>
    <documentsItem>{$ctx:documentsItem}</documentsItem>
    <issueDate>{$ctx:issueDate}</issueDate>
    <totalTax>{$ctx:totalTax}</totalTax>
    <shippingAddress>{$ctx:shippingAddress}</shippingAddress>
	<totalPrice>{$ctx:totalPrice}</totalPrice>
</salesbinder.updateDocument>
Properties
  • id: The ID of the document.
  • contextId: The ID of the context.
  • totalCost: Total value of the cost.
  • customerId: The ID of the customer.
  • totalTax2: Total value of the tax2.
  • documentsItem: Array of the documents item.
  • issueDate: The date of issue.
  • totalTax: Total value of the tax.
  • shippingAddress: The shipping address.
  • totalPrice: Total value of the price.
Sample request

Following is a sample REST/JSON request that can be handled by the updateDocument operation.

Sample Request for updateDocument
{
    "apiUrl": "https://sblsoft.salesbinder.com",
    "apiKey": "cb2192d4832db952ac5d0ec9f41770e88c733c0f",
    "id": "54d9f0df-7224-430d-9e66-67c30ad26590",
    "contextId": "11",
    "totalCost": "3000.00",
    "customerId": "54d35e07-d974-4401-9152-065a0ad26590",
    "totalTax": "40.00",
    "totalTax2": "50.00",
    "issueDate": "2015-02-22",
    "shippingAddress": "(Same as above)",
    "totalPrice": "1500.00",
    "documentsItem": [
        {
            "item_id": "54d35f54-d774-40cd-a958-04be0ad26590",
            "unit_id": 2,
            "description": "updated!",
            "quantity": "4.00",
            "tax": "2.00",
            "tax2": "3.00",
            "cost": "1300.00",
            "price": "1600.00"
        }
    ]
}
Related SalesBinder documentation
http://www.salesbinder.com/kb/api-functions/edit-document/

Sample configuration

Following is a sample proxy service that illustrates how to connect to SalesBinder with the init operation and use the createDocumentet operation. The sample request for this proxy can be found in the createDocument sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
	<proxy xmlns="http://ws.apache.org/ns/synapse" name="salesbinder_createDocument" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
	 <target>
	 <inSequence onError="faultHandlerSeq">
      <property name="apiUrl" expression="json-eval($.apiUrl)"/>
      <property name="apiKey" expression="json-eval($.apiKey)"/>
      <property name="contextId" expression="json-eval($.contextId)"/>
      <property name="totalCost" expression="json-eval($.totalCost)"/>
      <property name="customerId" expression="json-eval($.customerId)"/>
      <property name="totalTax2" expression="json-eval($.totalTax2)"/>
      <property name="documentsItem" expression="json-eval($.documentsItem)"/>
      <property name="issueDate" expression="json-eval($.issueDate)"/>
      <property name="totalTax" expression="json-eval($.totalTax)"/>
      <property name="dropShipCustomerId" expression="json-eval($.dropShipCustomerId)"/>
      <property name="shippingAddress" expression="json-eval($.shippingAddress)"/>
      <property name="totalPrice" expression="json-eval($.totalPrice)"/>
      <salesbinder.init>
         <apiUrl>{$ctx:apiUrl}</apiUrl>
         <apiKey>{$ctx:apiKey}</apiKey>
      </salesbinder.init>
      <salesbinder.createDocument>
         <contextId>{$ctx:contextId}</contextId>
         <totalCost>{$ctx:totalCost}</totalCost>
         <customerId>{$ctx:customerId}</customerId>
         <totalTax2>{$ctx:totalTax2}</totalTax2>
         <documentsItem>{$ctx:documentsItem}</documentsItem>
         <issueDate>{$ctx:issueDate}</issueDate>
         <totalTax>{$ctx:totalTax}</totalTax>
         <dropShipCustomerId>{$ctx:dropShipCustomerId}</dropShipCustomerId>
         <shippingAddress>{$ctx:shippingAddress}</shippingAddress>
         <totalPrice>{$ctx:totalPrice}</totalPrice>
      </salesbinder.createDocument>
	   <respond/>
	 </inSequence>
	  <outSequence>
	   <send/>
	  </outSequence>
	 </target>
   <description/>
  </proxy>