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

Get Inventory Category List

Get the Category List for TASQ.

URL:

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

Supports:

GET

Attribute Details:

Json Login

{
Login Name					String			must
Client IP						String			optional
Password					String			must
Mobile Device Token			String			optional
WebApi TOKEN				Guid (36)			must
}
Return Value:
{
    "Action Code": null,
    "Is Successed": "YES",
    "Error Message": "",
    "Return Data": [
        {
            "Category ID": "333fc792-e302-49df-850a-36258bf7ca23",
            "Category Name": "aaa",
            "Is Inactive": false,
            "HasExportedToQ6": false
        }
    ]
}

C# Sample Code:

public static string Get Inventory Category List (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:

function GetInventoryCategoryList () {
        $.ajax({
            type: "Get",
            url: Url,
            dataType: "json",
            success: function (data) {
                console.dir(data)
            },
            error: function (e) {
                console.dir(e)
            }
        });
    }

Java Sample Code:

private static void GetInventoryCategoryList(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:

func GetInventoryCategoryList ()
{
    let loginDetail: LoginDetail = LoginDetail()
    let UrlString = TASQSampleCommonLibrary.TASQApiUrl
    var arrayData = Parameters()
    
    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 = ""
    
    let EncodeAttachedURL = (jasonLoginDeail + attachedURL).addingPercentEncoding(withAllowedCharacters: .urlHostAllowed )! as String
    
    let url : String = UrlString + "Item/GetInventoryCategoryList?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?