Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
dctrackclient
Advanced tools
WARNING: this project is still under development and may not be stable!
Sunbird dcTrack API clients in Python and JavaScript
dcTrackClient can be installed from the package manager of your choice.
pip install dcTrackClient==0.7.2
npm i dctrackclient@0.7.2
Authentication is by using a base URL (the same URL to access the GUI) and a username and password, or a base URL and an API token.
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')
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' });
Obtain an API token using the
Client.generateToken()
function provided. Re-authentication is not necessary, the API token will automatically be used in subsequent API calls. The function returns the token's value in case the user wants to store the token for the next initialization of the API.
token = api.generateToken()
Notice the await
keyword before the function call. This is because the JavaScript library is asynchronous and returns a Promise
to the return value. All the API calls in this library require that keyword.
const token = await api.generateToken();
This section demonstrates item manipulation with the API client.
This example shows the minimum attributes required to create an item using the
createItem
function. View the comprehensive list of item attributes in the official documentation. Make sure to capture the return value of this function to see the created item details, such as the unique numeric item ID, or to determine if an error occurred while creating an item.
response = api.createItem(True/False, {
'cmbLocation': 'item location',
'tiName': 'item name',
'cmbMake': 'item make',
'cmbModel': 'item model'
})
print(response)
See the JavaScript section on obtaining an API token why the await
keyword is required.
let response = await api.createItem(true/false, {
'cmbLocation': 'item location',
'tiName': 'item name',
'cmbMake': 'item make',
'cmbModel': 'item model'
});
console.log(response);
This function returns the JSON object for the newly created item. This is an example response if returnDetails
was set to false.
{ "item": { "id": 1234, "tiName": "item name" } }
This function returns a JSON object containing the error message.
This example shows the usage of the
getItem
function.
response = api.getItem(1234)
let response = await api.getItem(1234);
{
"item": {
"cmbLocation": "item location",
"tiName": "item name",
...
}
}
This example shows the usage of the
updateItem
function. Any number of attributes can be included in the payload to be modified.
response = api.updateItem(1234, False, {'tiSerialNumber': 12345})
let response = await api.updateItem(1234, false, { 'tiSerialNumber': 12345 });
This example demonstrates usage of the
searchItems
function. Follow this guide for details on creating the request payload.
response = api.searchItems(0, 0, {
'columns': [
{'name': 'tiName', 'filter': {'eq': 'item name'}}
],
'selectedColumns': [
{'name': 'id'},
{'name': 'tiName'},
]
})
let response = await api.searchItems(0, 0, {
'columns': [
{ 'name': 'tiName', 'filter': { 'eq': 'item name' } }
],
'selectedColumns': [
{ 'name': 'id' },
{ 'name': 'tiName' },
]
});
{
"selectedColumns": [],
"totalRows": 1,
"pageNumber": 0,
"pageSize": 0,
"searchResults": {
"items": [
{"id": "1234", "tiName": "item name"}
]
}
}
This example demonstrates usage of the
deleteItem
function.
api.deleteItem(1234)
await api.deleteItem(1234);
{ "itemId": 1234 }
Visit this link for the official documentation on request bodies and attrribute names.
https://www.sunbirddcim.com/help/dcTrack/v900/API/en/Default.htm
The section below shows all the functions contained within this client along with basic usage.
Get item details using the item ID.
GET api/v2/dcimoperations/items/{id}
Parameter | Type |
---|---|
id | number |
Create a new item. When returnDetails is set to true, the API call will return the full json payload. If set to false, the call returns only the "id" and "tiName".
POST api/v2/dcimoperations/items payload
Parameter | Type |
---|---|
returnDetails | boolean |
payload | object |
Update an existing item. When returnDetails is set to true, the API call will return the full json payload. If set to false, the call returns only the "id" and "tiName".
PUT api/v2/dcimoperations/items/{id} payload
Parameter | Type |
---|---|
id | number |
returnDetails | boolean |
payload | object |
Delete an item using the item ID.
DELETE api/v2/dcimoperations/items/{id}
Parameter | Type |
---|---|
id | number |
Search for items using criteria JSON object. Search criteria can be any of the fields applicable to items, including custom fields. Specify the fields to be included in the response. This API supports pagination. Returns a list of items with the specified information.
POST api/v2/quicksearch/items payload
Parameter | Type |
---|---|
pageNumber | number |
pageSize | number |
payload | object |
Returns a list of Items contained in a Cabinet using the ItemID of the Cabinet. The returned list includes all of the Cabinet's Items including Passive Items.
GET api/v2/items/cabinetItems/{CabinetId}
Parameter | Type |
---|---|
CabinetId | number |
Add/Update/Delete Items.
POST api/v2/dcimoperations/items/bulk payload
Parameter | Type |
---|---|
payload | object |
Returns a list of makes with basic information.
GET api/v2/makes
No parameters.
Add a new Make. Returns JSON entity containing Make information that was passed in from the Request payload.
POST api/v2/makes payload
Parameter | Type |
---|---|
payload | object |
Modify a Make. Returns JSON entity containing Make information that was passed in from the Request payload.
PUT api/v2/makes/{makeId} payload
Parameter | Type |
---|---|
makeId | number |
payload | object |
Delete a Make.
DELETE api/v2/makes/{makeId}
Parameter | Type |
---|---|
makeId | number |
Search for a make using the make name. Returns a list of makes with basic information.
POST api/v2/dcimoperations/search/makes/{makeName} payload
Parameter | Type |
---|---|
makeName | string |
payload | object |
Get Model fields for the specified Model ID. usedCounts is an optional parameter that determines if the count of Items for the specified model is returned in the response. If set to "true" the counts will be included in the response, if omitted or set to "false" the item count will not be included in the response.
GET api/v2/models/{modelId}
Parameter | Type |
---|---|
modelId | number |
usedCounts | number |
Add a new Model. Returns JSON entity containing Make information that was passed in from the Request payload. "proceedOnWarning" relates to the warning messages that are thrown in dcTrack when you try to delete custom fields that are in use. The "proceedOnWarning" value can equal either "true" or "false." If "proceedOnWarning" equals "true," business warnings will be ignored. If "proceedOnWarning" equals "false," business warnings will not be ignored. Fields that are not in the payload will remain unchanged.
POST api/v2/models payload
Parameter | Type |
---|---|
returnDetails | boolean |
proceedOnWarning | boolean |
payload | object |
Modify an existing Model. Fields that are not in the payload will remain unchanged. Returns a JSON entity containing Make information that was passed in from the Request payload.
PUT api/v2/models/{id} payload
Parameter | Type |
---|---|
id | number |
returnDetails | boolean |
proceedOnWarning | boolean |
payload | object |
Delete a Model using the Model ID.
DELETE api/v2/models/{id}
Parameter | Type |
---|---|
id | number |
Search for models by user supplied search criteria. Returns a list of models with the "selectedColumns" returned in the payload. Search by Alias is not supported.
POST api/v2/quicksearch/models payload
Parameter | Type |
---|---|
pageNumber | number |
pageSize | number |
payload | object |
Delete a Mode Image using the Model ID and the Image Orientation, where id is the Model Id and orientation is either front or back
DELETE api/v2/models/images/{id}/{orientation}
Parameter | Type |
---|---|
id | number |
orientation | string |
Get a Connector record by ID. Returns a Connector with all information including Compatible Connectors. The usedCount parameter is optional. If usedCount is true, the response will include the number of times the connector is in use by Models and Items. If false, no counts are returned. If omitted the default is false.
GET api/v2/settings/connectors/{connectorId}
Parameter | Type |
---|---|
connectorId | number |
usedCount | boolean |
Add a new Connector. Returns JSON entity containing Connector information that was passed in from the Request payload.
POST api/v2/settings/connectors payload
Parameter | Type |
---|---|
payload | object |
Update an existing Connector. Returns JSON entity containing Connector information that was passed in from the Request payload.
PUT api/v2/settings/connectors/{connectorId} payload
Parameter | Type |
---|---|
connectorId | number |
payload | object |
Delete one or more Connector records.
POST api/v2/settings/connectors/delete payload
Parameter | Type |
---|---|
payload | object |
Retrieve a List of Connectors. Returns JSON entity containing Connector information that was passed in from the Request payload. Please note, Compatible Connectors are not returned by this API, but can be returned when querying a single Connector using the /api/v2/settings/connectors/{connectorId} API.
POST api/v2/settings/connectors/quicksearch payload
Parameter | Type |
---|---|
pageNumber | number |
pageSize | number |
usedCount | boolean |
payload | object |
Delete a Connector Image using the Connector ID.
DELETE api/v2/settings/connectors/{connectorId}/images
Parameter | Type |
---|---|
connectorId | number |
Use the REST API to retrieve details from all data ports on an item. If the operation was successful, a status code 200 is displayed, and the body contains the item's data port details. If the operation failed, an error code is returned.
GET api/v1/items/{itemId}/dataports
Parameter | Type |
---|---|
itemId | number |
Use the REST API to read the details of an item's data port. To do this, specify the item and item data port ID. If the operation was successful, a status code 200 is displayed, and the body contains the item's data port details. If the operation failed, an error code is returned.
GET api/v1/items/{itemId}/dataports/{dataportId}
Parameter | Type |
---|---|
itemId | number |
dataportId | number |
Use the REST API to create data ports for an existing item. If ports are already defined for the item because it is included in the Item Models Library, you can use the REST API to create additional ports for the item. Payload contains data port parameter details in json format. All required fields must be included.
POST api/v1/items/{itemId}/dataports payload
Parameter | Type |
---|---|
itemId | number |
payload | object |
Update an item's data port details using the REST API. To do this, specify the item and data port ID, and provide the updated parameter value(s). Payload contains data port parameter details in json format. All required fields must be included.
PUT api/v1/items/{itemId}/dataports/{dataportId} payload
Parameter | Type |
---|---|
itemId | number |
dataportId | number |
payload | object |
Delete an item's data port using the REST API by specifying the item ID and data port ID. If the operation is successful, a status code 200 is displayed. If the operation failed, an error code is returned.
DELETE api/v1/items/{itemId}/dataports/{dataportId}
Parameter | Type |
---|---|
itemId | number |
dataportId | number |
Use the REST API to retrieve details from all power ports on an item.
GET api/v1/items/{itemId}/powerports
Parameter | Type |
---|---|
itemId | number |
Use the REST API to retrieve details from one power port on an item.
GET api/v1/items/{itemId}/powerports/{portId}
Parameter | Type |
---|---|
itemId | number |
portId | number |
Use the REST API to create power ports for an existing item. If ports are already defined for the item because it is included in the Item Models Library, you can use the REST API to create additional ports for the item.
PUT api/v1/items/{itemId}/powerports/{portId} payload
Parameter | Type |
---|---|
itemId | number |
portId | number |
proceedOnWarning | boolean |
payload | object |
Use the REST API to determine if a Connector is compatible with a specific Power Port.
GET api/v1/items/{itemId}/powerports/{portId}/connectors/{connectorId}/isCompatible
Parameter | Type |
---|---|
itemId | number |
portId | number |
connectorId | number |
Returns a list for all Locations.
GET api/v1/locations
No parameters.
Get a single Location. Returns json containing location data for the specified ID.
GET api/v1/locations{locationId}
Parameter | Type |
---|---|
locationId | number |
Add a Location. Returns the JSON entity containing location info that was passed in. Note: "proceedOnWarning" relates to the warning messages that are thrown in dcTrack when you try to delete custom fields that are in use. The "proceedOnWarning" value can equal either "true" or "false." If "proceedOnWarning" equals "true," business warnings will be ignored. If "proceedOnWarning" equals "false," business warnings will not be ignored.
POST api/v1/locations payload
Parameter | Type |
---|---|
proceedOnWarning | boolean |
payload | object |
Modify Location details for a single Location. Payload contains new location details. You do not have have to provide all details, but only those that you want to modify. Returns JSON entity containing Location information that was passed in from the Request payload.
PUT api/v1/locations/{locationId} payload
Parameter | Type |
---|---|
locationId | number |
proceedOnWarning | boolean |
payload | object |
Delete a Location.
DELETE api/v1/locations/{locationId}
Parameter | Type |
---|---|
locationId | number |
Search for Locations by user supplied search criteria. Returns a list of Locations with the "selectedColumns" returned in the payload.
POST api/v2/quicksearch/locations payload
Parameter | Type |
---|---|
pageNumber | number |
pageSize | number |
payload | object |
Returns a list of all Location fields.
GET api/v2/quicksearch/locations/locationListFields
No parameters.
Get the sublocation tree.
GET api/v2/subLocations/tree
No parameters.
Get all sub-locations for a given location in the hierarchy. The locationId is the ID of the location to get the sub-locations for.
GET api/v2/subLocations/list/{locationId}
Parameter | Type |
---|---|
locationId | number |
Get all sub-locations of given type for a given location in the hierarchy. The locationId is the id of the location you are querying the sub-location types for. The type is one of either 5016 and 5017 for rows and aisles respectively.
GET api/v2/subLocations/{locationId}/type/{typeCode}
Parameter | Type |
---|---|
locationId | number |
typeCode | string |
Get all child sub-locations for a given sub-location in the hierarchy. The locationId is the ID of the location to fetch the sub-locations for. The subLocationId is the ID of the parent sub-location that you are querying the children of.
GET api/v2/subLocations/{subLocationId}/children
Parameter | Type |
---|---|
subLocationId | number |
Get details for a given sub-location. The subLocationId is the id of the sub-location you are querying for.
GET api/v2/subLocations/{subLocationId}
Parameter | Type |
---|---|
subLocationId | number |
Add a new sub-location to the given location. Returns a list from the Sub-Location Hash.
POST api/v2/subLocations payload
Parameter | Type |
---|---|
payload | object |
Update a sub-location. Returns a list from the Sub-Location Hash.
PUT api/v2/subLocations/{subLocationId} payload
Parameter | Type |
---|---|
subLocationId | number |
payload | object |
Deletes the given sub-location. The locationId is the ID of the location that the sub-location belongs to and the subLocationId is the ID of the location you are querying. Returns a success message upon success.
DELETE api/v2/subLocations/{subLocationId}
Parameter | Type |
---|---|
subLocationId | number |
Retrieve a List of Location Favorites for a specific User.
GET api/v2/users/{username}/favorites/LOCATION
Parameter | Type |
---|---|
username | string |
Retrieve a List of Location Favorites for all Users. Returns JSON entity containing Location Favorite information for all users.
GET api/v2/users/favorites/LOCATION
No parameters.
Assign Location Favorites to a user where username is a valid dcTrack user and "favorite" is either true or false to indicate whether you are assigning or unassigning. JSON entity containing all Location Favorites for the specified user.
PUT api/v2/users/{username}/favorites payload
Parameter | Type |
---|---|
username | string |
payload | object |
Assign Location Favorites to a user. To Assign favorites the "favorite" column should be set to true. To Unassign favorites the "favorite" column should be set to false. Returns JSON entity containing all Location Favorites for the specified users.
PUT api/v2/users/favorites payload
Parameter | Type |
---|---|
payload | object |
Find Cabinets with available space based on RUs within the specified Locations.
POST api/v2/capacity/cabinets/list/search payload
Parameter | Type |
---|---|
payload | object |
Find the starting RUs within a Cabinet with the specified number of contiguous RUs.
POST api/v2/items/uposition/available payload
Parameter | Type |
---|---|
payload | object |
Get explicit permission by ID. Returns JSON entity containing Permission information for the specified Permission Id.
GET api/v2/permissions/explicit/{permissionId}
Parameter | Type |
---|---|
permissionId | number |
Add explicit permission. Returns JSON entity containing Permission information for the added Permission.
POST api/v2/permissions/explicit payload
Parameter | Type |
---|---|
payload | object |
Update explicit permission. Returns JSON entity containing Permission information for the updated Permission.
PUT api/v2/permissions/explicit/{permissionId} payload
Parameter | Type |
---|---|
permissionId | number |
payload | object |
Delete explicit permission.
DELETE api/v2/permissions/explicit/{permissionId}
Parameter | Type |
---|---|
permissionId | number |
Add/Update/Delete explicit permissions.
POST api/v2/permissions/explicit/bulk payload
Parameter | Type |
---|---|
payload | object |
Get all explicit permissions. Returns JSON entity containing Permission information.
GET api/v2/permissions/explicit
No parameters.
Get explicit permissions by Entity Type. Returns JSON entity containing Permission information.
GET api/v2/permissions/explicit/entityType/{entityType}
Parameter | Type |
---|---|
entityType | string |
Get explicit permissions by Entity Type and Entity ID. Returns JSON entity containing Permission information.
GET api/v2/permissions/explicit/{entityType}/{entityId}
Parameter | Type |
---|---|
entityType | string |
entityId | number |
Get a list of records (options) for use in drop-down lists by indicating a list type and an ID. ID is optional for some list types. Returns a list of records for a given list type.
GET api/v2/dcimoperations/lookups/{listType}/{id}
Parameter | Type |
---|---|
listType | string |
id | number |
Get a list of records (options) for use in drop-down lists for dcTrack standard fields by list type. Returns a list of records for a given list type.
GET api/v2/dcimoperations/picklists/{listType}
Parameter | Type |
---|---|
listType | string |
Update a list of records (options) for use in drop-down lists for dcTrack standard fields by list type. Returns a list of records for a given list type.
PUT api/v2/dcimoperations/picklists/{listType} payload
Parameter | Type |
---|---|
listType | string |
payload | object |
0.7.2
FAQs
Sunbird dcTrack API client in JavaScript
The npm package dctrackclient receives a total of 2 weekly downloads. As such, dctrackclient popularity was classified as not popular.
We found that dctrackclient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.