### Install dcTrackClient Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Installs the dcTrackClient library using package managers. Specify the version for installation. ```shell pip install dcTrackClient==%VERSION% ``` ```shell npm i dctrackclient@%VERSION% ``` -------------------------------- ### Delete Item Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Provides an example of how to delete an item using its unique ID. This function requires the item's ID as a parameter. ```Python api.deleteItem(1234) ``` ```JavaScript await api.deleteItem(1234); ``` -------------------------------- ### Initialize dcTrack API Connection Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Establishes a connection to the dcTrack API using either username/password or an API token. The base URL of the dcTrack GUI is required. ```python from dcTrackClient import Client ## Using a username and password ## api = Client('https://dctrack.example.com/', username='user', password='pass') ## Using an API token ## api = Client('https://dctrack.example.com/', apiToken='token') ``` ```javascript import { Client } from 'dctrackclient'; // Using a username and password // const api = new Client('https://dctrack.example.com/', { username: 'user', password: 'pass' }); // Using an API token // const api = new Client('https://dctrack.example.com/', { apiToken: 'token' }); ``` -------------------------------- ### Initialize dcTrack API Connection with Proxy Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Configures a connection to the dcTrack API with proxy support for both authentication methods. Python supports HTTP, HTTPS, and SOCKS proxies, while JavaScript requires a single proxy configuration. ```python api = Client('https://dctrack.example.com/', username='user', password='pass', httpProxy='http://proxy:port', httpsProxy='https://proxy:port') ``` ```javascript const api = new Client('https://dctrack.example.com/', { username: 'user', password: 'pass' }, { https: 'http://proxy:port', socks: 'socks://proxy:port' }); ``` -------------------------------- ### Search for Item Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Illustrates how to search for items based on specified criteria. This function takes pagination parameters and a payload defining search columns and filters. It returns a list of matching items with selected columns. ```Python response = api.searchItems(0, 0, { 'columns': [ {'name': 'tiName', 'filter': {'eq': 'item name'}} ], 'selectedColumns': [ {'name': 'id'}, {'name': 'tiName'}, ] }) ``` ```JavaScript let response = await api.searchItems(0, 0, { 'columns': [ { 'name': 'tiName', 'filter': { 'eq': 'item name' } } ], 'selectedColumns': [ { 'name': 'id' }, { 'name': 'tiName' }, ] }); ``` -------------------------------- ### Generate API Token Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Generates an API token using the `generateToken()` function. The token can be stored for future API initializations. JavaScript requires the `await` keyword due to its asynchronous nature. ```python token = api.generateToken() ``` ```javascript const token = await api.generateToken(); ``` -------------------------------- ### Create Item in dcTrack Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Creates a new item in dcTrack using the `createItem` function with essential attributes. The function can return full item details or a simplified response. Error handling is included. ```python # Set `returnDetails = True` to return the complete item field list. response = api.createItem(False, { 'cmbLocation': 'item location', 'tiName': 'item name', 'cmbMake': 'item make', 'cmbModel': 'item make' }) print(response) ``` ```javascript // Set `returnDetails = true` to return the complete item field list. let response = await api.createItem(false, { 'cmbLocation': 'item location', 'tiName': 'item name', 'cmbMake': 'item make', 'cmbModel': 'item make' }); console.log(response); ``` -------------------------------- ### Retrieve Item Details Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Demonstrates how to retrieve the full list of attributes for a specific item using its unique ID. This function requires the item's ID as input and returns a JSON object containing the item's details. ```Python response = api.getItem(1234) ``` ```JavaScript let response = await api.getItem(1234); ``` -------------------------------- ### Modify Existing Item Source: https://github.com/nicfv/dctrackclient/blob/main/README.md Shows how to update an existing item by providing its ID, a boolean indicating whether to return details, and a payload containing the attributes to be modified. Multiple attributes can be updated in a single request. ```Python response = api.updateItem(1234, False, {'tiSerialNumber': 12345}) ``` ```JavaScript let response = await api.updateItem(1234, false, { 'tiSerialNumber': 12345 }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.