Skip to content

stockTransactionV2

Supported, no replacement yet

This endpoint remains fully supported. No replacement exists in the new API yet, and no action is needed. When a replacement ships you will get 12 months' notice, and this site will be updated.

Reference

/rest/stockMgmt/stockTransaction

POST
Adds a stock transaction.

  • Type represents type of stock transaction:
    • "1" - Usage
    • "2" - UsageUpdate
    • "3" - Purchase
  • lookupPartByPartNumber
    • if set to 0 or not supplied value in partId field will be used to look up Part by Part ID
    • if set to 1, value in partId field will be used to look up Part by Part Number and a new part created if not found
  • lookupStoreByResourceRef
    • if set to 0 or not supplied values in fromStoreId and toStoreId will be used to look up Store by Store ID
    • if set to 1 values in fromStoreId and toStoreId will be used to look up Store by Resource Ref
  • fromStoreId or toStoreId may both be null
  • Stock transaction record added.
  • Stock levels on from and to stores adjusted.
  • If type is Usage or UsageUpdate the apptID field or the jobRef field must be populated.
  • If type is Usage a Materials Job Cost record is added using the cost associated to the Part unless the unitCost field is included in which case this cost is used
  • If type is UsageUpdate the jobCostId field must be populated.
  • If type is UsageUpdate the Job Cost record is updated or, if the quantity ends up as zero, deleted.
  • Returns jobCostId and newPartId where appropriate.
  • The quantity is a delta value and is +ve (selecting from/to store should avoid -ve values)

  • partDescription - mandatory if partId cannot be found (i.e. adding a new part)
  • partCategoryId - mandatory if partId cannot be found (i.e. adding a new part)
  • reOrderLevel - optional - defaults to 1 if not supplied and new Part is created
  • reOrderQty - optional - defaults to 1 if not supplied and new Part is created
  • uomId - optional - defaults to 0 if not supplied and new Part is created
  • jobRef - optional
  • if partID or partNumber cannot be found create new part using partID, partDescription, partCategoryId, reOrderLevel, reOrderQty, uomId and unitCost values
  • if jobRef is supplied and type is PURCHASE a Materials Job Cost record is added
  • if type is USAGE either apptId or jobRef or both must be supplied and a JobCost record created
  • vendorId is optional but if provided must match an existing vendor

acceptable request representations:

  • application/json
{    "type" : "1"        "lookupPartByPartNumber" : "1",    "lookupStoreByStoreNumber" : "1",
    "partId" : "32728",    "partDescription" : "12 inch nail",    "partCategoryId": "3",
    "reOrderLevel" : "3",
    "reOrderQty" : "7",    "uomId" : "1"    "jobRef" : "J00089",    "unitCost" : "34.45",    "dateTime" : "12/12/2013 12:34",    "vendorId" : "2",
    "fromStoreId" : "56",    "toStoreId": "8",    "ref" : "bdbfh888",    "apptId" : "338892",    "qty" : "7",  // change in quantity
    "jobCostId" : "7574"}


available response representations:
  • 200 - application/json
{
    "result" : "success or fail",
    "result_msg" : "error message", 
    # may also return 
    "jobCostId" : "5656", 
    "newPartId" : "8181"
}



See the Stock Management API matrix for the full list of endpoints in this category.