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 Stock Adjustments in TradeGecko

The createStockAdjustment operation creates a new stock adjustment.

createStockAdjustment
<tradegecko.createStockAdjustment>
    <adjustmentNumber>{$ctx:adjustmentNumber}</adjustmentNumber>
    <notes>{$ctx:notes}</notes>
    <reason>{$ctx:reason}</reason>
    <stockAdjustmentLineItems>{$ctx:stockAdjustmentLineItems}</stockAdjustmentLineItems>
	<stockLocationId>{$ctx:stockLocationId}</stockLocationId>
</tradegecko.createStockAdjustment>
Properties
  • adjustmentNumber: A unique identifier for the stock adjustment.
  • notes: Notes related to the stock adjustment.
  • reason: The reason for the stock adjustment.
  • stockAdjustmentLineItems: Stock adjustment line items to add.
  • stockLocationId: The ID of the location for the stock adjustment.
Sample request

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

Sample Request for createStockAdjustment
{
	"apiUrl":"https://api.tradegecko.com",
	"accessToken":"999317c11a0dfaabc10ca6fb691ff49a067c6fba602f1a0c989648964bed2783",
	"adjustmentNumber" : "SA0011",
	"notes" : "This is a test adjustment",
	"reason" : "promotion",
	"stockLocationId" : "3723",
	"stockAdjustmentLineItems" : [
			{ 
			  "quantity":"10",
			  "variant_id":2972234
			}
		]
}
Related TradeGecko documentation

http://developer.tradegecko.com/api/stock-adjustment/

Sample configuration

Following is a sample proxy service that illustrates how to connect to TradeGecko with the init operation and use the createStockAdjustment operation. The sample request for this proxy can be found in createStockAdjustment sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tradegecko_createStockAdjustment"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="adjustmentNumber" expression="json-eval($.adjustmentNumber)"/>
         <property name="notes" expression="json-eval($.notes)"/>
         <property name="reason" expression="json-eval($.reason)"/>
         <property name="stockAdjustmentLineItems" expression="json-eval($.stockAdjustmentLineItems)"/>
         <property name="stockLocationId" expression="json-eval($.stockLocationId)"/>
         <tradegecko.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </tradegecko.init>
         <tradegecko.createStockAdjustment>
            <adjustmentNumber>{$ctx:adjustmentNumber}</adjustmentNumber>
            <notes>{$ctx:notes}</notes>
            <reason>{$ctx:reason}</reason>
            <stockAdjustmentLineItems>{$ctx:stockAdjustmentLineItems}</stockAdjustmentLineItems>
            <stockLocationId>{$ctx:stockLocationId}</stockLocationId>
         </tradegecko.createStockAdjustment>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>