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

Get Inventory List

Return, update, create and delete inventory items for JobTasq

Get the Inventory list for TASQ.

URL:

https://jobapi.tasq.com.au/api/Item/GetInventoryList?Jsonlogin={“LoginName”:”testapi@tasq.com.au”,”ClientIP”:null,”Password”:”test123.”,”MobileDeviceToken”:null,”WebApiTOKEN”:”b3b777b0-c7af-458d-be64-b3d6d760177f”}

Supports:

GET

Attribute Details:

Json Login

{
LoginName					String			must
ClientIP						String			optional
Password					String			must
MobileDeviceToken			String			optional
WebApiTOKEN				Guid(36)			must
}
Return Value:
{
	"ActionCode": null,
	"IsSuccessed": "YES",
	"ErrorMessage": "",
	"ReturnData": [{
			"InventoryID": "9d1932d5-aea6-4665-84bb-822c725e3efd",
			"InventoryName": "InventoryTEST1",
			"InventoryType": "Inventory",
			"SupplierPartNumber": "wewe",
			"CategoryID": "9006f165-bf77-46c5-89eb-2ed18e0f7e77",
			"PurchasePrice": 10,
			"IsPurchasePriceTaxInclusive": true,
			"PurchaseTaxCodeID": "994b802a-6c31-4ee6-9178-054e562e8535",
			"SellingPrice": 11,
			"IsSalePriceTaxInclusive": true,
			"SaleDescription": "54",
			"SaleTaxCodeID": "9b545609-d609-4ba4-ae8b-3b1680a29457",
			"IsInventory": true,
			"IsInactive": false,
			"HasExportedToQ6": false,
			"PurchaseDescription": "!2#$^%&*((",
			"IsRecordTimeTracking": false,
			"IsBuiltIn": false,
			"IsDefaultRecordTimeTracking": false
		}
	]
}

C# Sample Code:

public static string GetInventoryList (string Url)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
            request.Method = "GET";
            request.ContentType = "application/json";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream myResponseStream = response.GetResponseStream();
            StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
            string retString = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();

            if (response != null)
            {
                response.Close();
            }
            if (request != null)
            {
                request.Abort();
            }

            return retString;
        }

Javascript:

  dataType: "json",
            success: function (data) {
                console.dir(data)
            },
            error: function (e) {
                console.dir(e)
            }
        });
}

Java Sample Code:

private static void GetInventoryList(String path){
    try {
        URL url = new URL(path);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
            InputStreamReader in = new InputStreamReader(connection.getInputStream());
            BufferedReader reader = new BufferedReader(in);
            String line = "";
            StringBuilder result = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                result.append(line);
            }
            reader.close();
            connection.disconnect();
            System.out.println(result);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

 

Swift Sample Code:


    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?
    
    let jasonLoginDeail = TASQSampleCommonLibrary.convertDictionaryToJSONData(dicData: arrayData as [String : AnyObject])
    
    let attachedURL: String = "&byEmail=" + byEmail + "&Property=" + property + "&SearchText=" + searchText  + "&IsLoadInactive=" + "NO" +  "&PageSize=" + String(pageSize) + "&PageIndex=1"
    
    let EncodeAttachedURL = (jasonLoginDeail + attachedURL).addingPercentEncoding(withAllowedCharacters: .urlHostAllowed )! as String
    
    let url : String = UrlString + "Item/GetInventoryList?Jsonlogin="  + EncodeAttachedURL

    let replacedUrlString = url.replacingOccurrences(of: "\\", with:"" )
    
    let request = NSMutableURLRequest(url: NSURL(string: replacedUrlString)! as URL, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData, timeoutInterval: 300)
    request.httpMethod = "GET"
    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?