1. Home
  2. Docs
  3. API Overview
  4. Documents – Invento...
  5. Edit Inventory

Edit Inventory

URL:

https://jobapi.tasq.com.au/api/Item/EditInventory

Supports:

POST

Attribute Details:

Company Validate Info:

Login Name String must
Client IP String optional
Password String must
Mobile Device Token String optional
Web Api TOKEN Guid (36) must

 

Inventory

Inventory ID        Guid (36) must
Inventory Name String (200) must
Inventory Type String (50) must Inventory/Service
Supplier Part Number String (200) optional
Category ID Guid (36) optional
Purchase Price Decimal (18.6) optional
Is Purchase Price Tax Inclusive Boolean must
Purchase Tax Code ID Guid (36) optional
Selling Price Decimal (18.6) optional
Is Sale Price Tax Inclusive Boolean must
Sale Description String optional
Sale Tax Code ID Guid (36) optional
Is Inventory Boolean  must
Is Inactive Boolean  must
Has Exported To Q6 String optional
Purchase Description Boolean optional
Is Record Time Tracking Boolean  must
Is Built In Boolean optional
Is Default Record Time Tracking Boolean  must

Example JSON Post request:

{
"CompanyValidateInfo": {
"ClientIP": null,
"LoginName": "testapi@tasq.com.au",
"MobileDeviceToken": null,
"Password": "test123.",
"WebApiTOKEN": "b3b777b0-c7af-458d-be64-b3d6d760177f"
},
	"Inventory": {
		"InventoryID": "b35892fb-95da-4ed0-ac4a-14a7b8bd5cbb",
		"InventoryName": "ServiceTestapivva",
		"InventoryType": "Service",
		"SupplierPartNumber": "111",
		"CategoryID": "b6be3327-b438-45d6-9179-ce89ec0952aa",
		"PurchasePrice": 554.00,
		"IsPurchasePriceTaxInclusive": true,
		"PurchaseTaxCodeID": "85a6ac5e-a9bd-41da-adea-ba28a6bfd510",
		"SellingPrice": 552.00,
		"IsSalePriceTaxInclusive": true,
		"SaleDescription": "ServiceTestapivva",
		"SaleTaxCodeID": "85a6ac5e-a9bd-41da-adea-ba28a6bfd510",
		"IsInventory": false,
		"IsInactive": false,
		"HasExportedToQ6": null,
		"IsRecordTimeTracking": true,
		"IsBuiltIn": null,
		"IsDefaultRecordTimeTracking": false
	}
}

Return Value:
{
	"ActionCode": "Edit",
	"IsSuccessed": "YES",
	"ErrorMessage": "",
	"ReturnData": null
}

C# Sample Code:

public static string EditInventory(string Url ,string content)
        {
            string result = "";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
            req.Method = "POST";
            req.ContentType = "application/json";

            #region Add Post Param
            byte[] data = Encoding.UTF8.GetBytes(content);
            req.ContentLength = data.Length;
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(data, 0, data.Length);
                reqStream.Close();
            }
            #endregion

            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            Stream stream = resp.GetResponseStream();
            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }
            return result;
        }

Java Script:

 function EditInventory () {
        $.ajax({
            type: "Post",
            url: " https://jobapi.tasq.com.au/api/Item/EditInventory",
            data: {
               …
            },
            dataType: "json",
            success: function (data) {
                console.dir(data)
            },
            error: function (e) {
                console.dir(e)
            }
        });
    }

Java Sample Code:

private static void EditInventory(String json){
    try {
        URL url = new URL("https://jobapi.tasq.com.au/api/Item/EditInventory");
        HttpURLConnection con = (HttpURLConnection)url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json; charset=utf-8");
        con.setRequestProperty("Accept", "application/json");
        con.setDoInput(true);
        con.setDoOutput(true);
        con.setUseCaches(false);
        con.setRequestProperty("Connection", "Keep-Alive");
        if (json != null){
            byte[] writeBytes = json.getBytes("utf-8");
            OutputStream outputStream = con.getOutputStream();
            outputStream.write(writeBytes,0, writeBytes.length);
            outputStream.flush();
            outputStream.close();
        }
        if (con.getResponseCode() == HttpURLConnection.HTTP_OK){
            InputStreamReader in = new InputStreamReader(con.getInputStream());
            BufferedReader br = new BufferedReader(in);
            StringBuilder response = new StringBuilder();
            String responseLine = null;
            while ((responseLine = br.readLine()) != null){
                response.append(responseLine.trim());
            }
            System.out.println(response.toString());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Swift Sample Code:

func EditInventory ()
{
    let inventory: Inventory = Inventory()
    let UrlString = TASQSampleCommonLibrary.TASQApiUrl + "Item/EditInventory"
    let loginDetail: LoginDetail = LoginDetail()
    var parameters = [String : AnyObject]()
    var arrayData = [String : AnyObject]()
    arrayData ["WebApiTOKEN"] = TASQSampleCommonLibrary.TASQApiTOKEN as AnyObject?
    arrayData ["LoginName"] = loginDetail.LoginEmail! as AnyObject?
    arrayData ["Password"] = loginDetail.LoginPassword! as AnyObject?
    arrayData ["ClientIP"] = TASQSampleCommonLibrary.getIPAddresses() as AnyObject?
    arrayData ["MobileDeviceToken"] = TASQSampleCommonLibrary.getMobileDeviceToken() as AnyObject?
    
    parameters["CompanyValidateInfo"] = arrayData as AnyObject?

    var inventoryData = [String : AnyObject]()
    inventoryData["InventoryID"] = inventory.InventoryID as AnyObject
    inventoryData["InventoryName"] =  inventory.InventoryName as AnyObject
    inventoryData["InventoryType"] =   inventory.InventoryType as AnyObject
    inventoryData["SupplierPartNumber"] =   inventory.SupplierPartNumber as AnyObject
    inventoryData["CategoryID"] =  inventory.CategoryID as AnyObject
    inventoryData["PurchasePrice"] =   inventory.PurchasePrice as AnyObject
    inventoryData["IsPurchasePriceTaxInclusive"] =  inventory.IsPurchasePriceTaxInclusive as AnyObject
    inventoryData["PurchaseTaxCodeID"] =  inventory.PurchaseTaxCodeID as AnyObject
    inventoryData["SellingPrice"] =  inventory.SellingPrice as AnyObject
    inventoryData["IsSalePriceTaxInclusive"] = inventory.IsSalePriceTaxInclusive as AnyObject
    inventoryData["SaleDescription"] =  inventory.SaleDescription as AnyObject
    inventoryData["SaleTaxCodeID"] =  inventory.SaleTaxCodeID as AnyObject
    inventoryData["IsInventory"] =  inventory.IsInventory as AnyObject
    inventoryData["IsInactive"] =  inventory.IsInactive as AnyObject
    inventoryData["IsRecordTimeTracking"] =  inventory.IsRecordingTimeTracking as AnyObject
    inventoryData["IsDefaultRecordTimeTracking"] =   inventory.IsDefaultRecordTimeTracking as AnyObject
    
    parameters["Inventory"]  = inventoryData as AnyObject
    
    let request = NSMutableURLRequest(url: NSURL(string: UrlString)! as URL, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData, timeoutInterval: 300)
    let jsonString = TASQSampleCommonLibrary.convertDictionaryToJSONData(dicData: parameters)
    print(jsonString)
    request.httpBody = jsonString.data(using: String.Encoding.utf8, allowLossyConversion: true)
    request.httpMethod = "POST"
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    do {
        let config = URLSessionConfiguration.default
        let session = URLSession(configuration: config)
        let task = session.dataTask(with: request as URLRequest, completionHandler: {
            (data, response, error)  in
        })
        task.resume()
    }
}

 

How can we help?