### Getting Started - Quick Setup Source: https://docs.trackstarhq.com/llms-full.txt Instructions for setting up Trackstar connections without coding. ```APIDOC # Getting Started ## Quick Setup (No Coding Required) You can start connecting WMS systems to Trackstar in minutes without writing any code using one of these methods: 1. Inputting WMS credentials directly into the Trackstar dashboard. 2. Sending a Magic Link to your customers to connect their WMS. ### 1. Inputting WMS Credentials If your customer has provided you with their WMS credentials, you can input them directly into the Trackstar dashboard. 1. Go to the [Connections page](https://dashboard.trackstarhq.com/connections) in the Trackstar dashboard. 2. Click the "Add Connection" button. 3. Select the WMS you want to connect. 4. Fill in the required fields (e.g. API key, username, password). 5. An access token will be generated for you. This token is used to authenticate requests to Trackstar. ``` -------------------------------- ### Python Example: Server Setup and Token Exchange Source: https://docs.trackstarhq.com/how-to-guides/getting-started A Python Flask example demonstrating how to set up a basic server and handle the token exchange process. ```APIDOC ## Python Example: Server Setup and Token Exchange ### Description This code snippet provides a basic example using Flask to set up a server that listens for incoming requests. It includes a placeholder for handling the token exchange process with the Trackstar API, demonstrating how to receive an authorization code and potentially other customer data. ### Method POST (for the /store-token endpoint) ### Endpoint `/store-token` (example endpoint for receiving auth code) ### Parameters #### Request Body (for /store-token) - **auth_code** (string) - Required - The temporary authorization code. - **customer_data** (object) - Optional - Customer-specific information. ### Request Example (for /store-token) ```json { "auth_code": "some_auth_code", "customer_data": { "email": "test@example.com" } } ``` ### Code Example (Python/Flask) ```python from flask import Flask, request import requests # Replace with your actual Trackstar API Key TRACKSTAR_API_KEY = "YOUR_TRACKSTAR_API_KEY" app = Flask(__name__) @app.route('/store-token', methods=['POST']) def store_token(): data = request.get_json() auth_code = data.get('auth_code') customer_data = data.get('customer_data') if not auth_code: return "Authorization code is required.", 400 # Exchange auth code for access token exchange_url = "https://api.trackstar.com/link/exchange" # Example URL headers = { "Authorization": f"Bearer {TRACKSTAR_API_KEY}", "Content-Type": "application/json" } payload = { "auth_code": auth_code } try: response = requests.post(exchange_url, headers=headers, json=payload) response.raise_for_status() # Raise an exception for bad status codes token_data = response.json() access_token = token_data.get('access_token') connection_id = token_data.get('connection_id') integration_name = token_data.get('integration_name') # Store access_token, connection_id, and integration_name in your database print(f"Successfully exchanged token: {access_token}") print(f"Connection ID: {connection_id}") print(f"Integration Name: {integration_name}") # Example: Store in a hypothetical database # db.save_connection(customer_data.get('user_id'), access_token, connection_id, integration_name) return "Token stored successfully.", 200 except requests.exceptions.RequestException as e: print(f"Error exchanging token: {e}") return f"Error during token exchange: {e}", 500 if __name__ == '__main__': # This example uses a hardcoded port, adjust as needed print("Server listening on port 3000") app.run(port=3000) ``` ``` -------------------------------- ### Webhook Transformations Example Source: https://docs.trackstarhq.com/llms-full.txt This example demonstrates how to route webhooks based on integration names using JavaScript transformations within Trackstar. ```APIDOC ## Routing by Integration Name You can route webhooks based on integration names to handle specific integrations differently. ### Description This JavaScript function intercepts incoming webhooks and modifies the `webhook.url` based on the `integration_name` found in the payload. It directs sandbox integrations to a test URL and others to a production URL. ### Method Not applicable (This is a transformation function, not an API endpoint). ### Endpoint Not applicable. ### Parameters None directly, but it operates on the `webhook` object. ### Request Example ```javascript function handler(webhook) { const sandboxIntegrations = ["Sandbox"]; const isSandboxIntegration = sandboxIntegrations.includes(webhook.payload.integration_name); if (isSandboxIntegration) { webhook.url = "https://your-app.com/webhooks/test"; } else { webhook.url = "https://your-app.com/webhooks/production"; } return webhook; } ``` ### Response Returns the modified `webhook` object with an updated `url` property. ``` -------------------------------- ### JavaScript Example with Axios Source: https://docs.trackstarhq.com/how-to-guides/sandbox This snippet demonstrates how to make a GET request to the Trackstar API using Axios in JavaScript, including setting necessary headers for authentication. ```APIDOC ## GET /api/resource (Example) ### Description This endpoint retrieves a resource from the Trackstar API. It requires authentication via an API key and an access token. ### Method GET ### Endpoint `/api/resource` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript const headers = { 'x-trackstar-api-key': 'YOUR_API_KEY', 'x-trackstar-access-token': 'an_access_token' // from the prior step }; const response = await axios.get(url, { headers }); ``` ### Response #### Success Response (200) - **data** (object) - The requested resource data. #### Response Example ```json { "data": { "id": "123", "name": "Example Resource" } } ``` ``` -------------------------------- ### Webhook Transformations - Example Routing by Connection ID Source: https://docs.trackstarhq.com/how-to-guides/webhooks This example demonstrates how to use webhook transformations to route webhooks to different endpoints based on the connection ID, distinguishing between test and production environments. ```APIDOC ## Webhook Transformations - Example Routing by Connection ID ### Description This JavaScript function demonstrates how to route webhooks to different URLs based on whether the connection is a test or production connection. It checks if the `connection_id` is present in a predefined list of test connection IDs and sets the `webhook.url` accordingly. ### Method Not Applicable (Transformation Script) ### Endpoint Not Applicable (Transformation Script) ### Parameters #### Request Body (Implicit) - **webhook** (object) - The incoming webhook object containing payload and URL information. - **webhook.payload.connection_id** (string) - The ID of the connection that triggered the webhook. - **webhook.url** (string) - The target URL for the webhook, which will be modified by the script. ### Request Example ```json { "webhook": { "payload": { "connection_id": "conn_test_abc123", "event_type": "inbound_shipment.updated", "data": { ... } }, "url": "https://your-app.com/webhooks/default" } } ``` ### Response #### Success Response (200) - **webhook** (object) - The modified webhook object with the updated URL. #### Response Example ```json { "webhook": { "payload": { "connection_id": "conn_test_abc123", "event_type": "inbound_shipment.updated", "data": { ... } }, "url": "https://your-app.com/webhooks/test" } } ``` ``` -------------------------------- ### Python API Call Example Source: https://docs.trackstarhq.com/how-to-guides/getting-started This example demonstrates how to make an API call to the Trackstar inventory endpoint using Python's requests library. It includes setting up the API key, access token, URL, and headers. ```APIDOC ## POST /wms/inventory ### Description This endpoint is used to retrieve inventory data from Trackstar. ### Method POST ### Endpoint https://production.trackstarhq.com/wms/inventory ### Parameters #### Query Parameters None #### Request Body This endpoint does not explicitly define a request body in the provided example, but typically for inventory retrieval, it might include filters or parameters. ### Request Example ```python import requests TRACKSTAR_API_KEY = "" ACCESS_TOKEN = "" url = "https://production.trackstarhq.com/wms/inventory" headers = { "X-API-KEY": TRACKSTAR_API_KEY, "Authorization": f"Bearer {ACCESS_TOKEN}" } response = requests.post(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` ### Response #### Success Response (200) - **inventory** (list) - A list of inventory items. - **item_id** (string) - The unique identifier for the inventory item. - **quantity** (integer) - The current quantity of the item. #### Response Example ```json { "inventory": [ { "item_id": "ITEM123", "quantity": 100 }, { "item_id": "ITEM456", "quantity": 50 } ] } ``` ``` -------------------------------- ### Trackstar API Successful Product Response Example Source: https://docs.trackstarhq.com/api-reference/wms-api/products/get-item Provides an example of a successful response when retrieving product information from the Trackstar API. This JSON object includes a 'data' field containing a populated WmsProductApiItemSchema object with sample product details. ```json { "data": { "id": "product_id", "warehouse_customer_id": "warehouse_customer_id", "created_date": "2022-01-01T00:00:00Z", "updated_date": "2022-01-02T05:05:05Z", "name": "name", "sku": "sku", "gtin": "gtin", "unit_price": 10.99, "inventory_items": [ { "inventory_item_id": "id1", "sku": "sku1", "unit_quantity": 1 }, { "inventory_item_id": "id2", "sku": "sku2", "unit_quantity": 1 } ], "is_kit": true, "active": true, "supplier": "supplier", "supplier_object": { "supplier_id": "supplier_id", "supplier_name": "supplier_name" }, "country_of_origin": "USA", "harmonized_code": "123456", "supplier_products": [ { "supplier_id": "id1", "supplier_name": "name1", "external_id": "ext_id1", "unit_cost": 1 }, { "supplier_id": "id2", "supplier_name": "name2", "external_id": "ext_id2", "unit_cost": 2.5 } ], "categories": [ "Electronics", "Accessories" ], "image_urls": [ "https://example.com/image1.jpg" ], "external_system_url": "https://example.com/product/123", "trackstar_tags": [ "tag1", "tag2", { "tag3": "value3" } ], "additional_fields": { "key": "value" }, "trackstar_created_date": "2023-11-07T05:31:56Z", "trackstar_updated_date": "2023-11-07T05:31:56Z" } } ``` -------------------------------- ### JavaScript Server Setup and Logging Source: https://docs.trackstarhq.com/how-to-guides/getting-started This snippet demonstrates setting up a basic Node.js server to listen on port 3000 and logs a confirmation message to the console. It includes styling information likely for a UI rendering context. ```javascript app.listen(3000, () => { console.log('Server listening on port 3000'); }); ``` -------------------------------- ### Perform Authenticated GET Request Source: https://docs.trackstarhq.com/how-to-guides/sandbox Demonstrates how to perform an authenticated GET request to the Trackstar API. The examples show how to include the necessary access tokens in the request headers. ```javascript const response = await axios.get(url, { headers: { 'x-trackstar-access-token': "an_access_token" } }); ``` ```shellscript curl --request GET \ --url https://production.trackstarhq.com/wms/inventory ``` -------------------------------- ### GET /wms/inventory Source: https://docs.trackstarhq.com/how-to-guides/sandbox Example of how to perform an authenticated request to the Trackstar sandbox inventory endpoint. ```APIDOC ## GET /wms/inventory ### Description Retrieves inventory data from the Trackstar sandbox environment using provided API credentials. ### Method GET ### Endpoint https://production.trackstarhq.com/wms/inventory ### Parameters #### Headers - **x-trackstar-api-key** (string) - Required - Your unique API key. - **x-trackstar-access-token** (string) - Required - The sandbox access token obtained from the connections dashboard. ### Request Example ```bash curl -X GET https://production.trackstarhq.com/wms/inventory \ -H "x-trackstar-api-key: YOUR_API_KEY" \ -H "x-trackstar-access-token: an_access_token" ``` ### Response #### Success Response (200) - **data** (array) - List of inventory items available in the sandbox environment. #### Response Example { "data": [ { "sku": "TEST-ITEM-001", "quantity": 100 } ] } ``` -------------------------------- ### Initialize API Client with Node.js Source: https://docs.trackstarhq.com/how-to-guides/getting-started This snippet shows how to set up an Axios client in Node.js and define configuration constants for API authentication. ```javascript const axios = require('axios'); const TRACKSTAR_API_KEY = ''; const ACCESS_TOKEN = ''; ``` -------------------------------- ### Initialize Express and Axios in Node.js Source: https://docs.trackstarhq.com/how-to-guides/getting-started This snippet demonstrates the initial setup of a Node.js server using the Express framework and importing Axios for HTTP requests. It serves as the foundation for building API endpoints. ```javascript const express = require('express'); const axios = require('axios'); const app = express(); ``` -------------------------------- ### Perform API Request with Authentication Source: https://docs.trackstarhq.com/how-to-guides/sandbox Demonstrates how to authenticate with the Trackstar API using an access token and perform a GET request to retrieve inventory data. The Python example uses the requests library, while the Node.js example uses axios. ```python headers = { "x-trackstar-access-token": "an_access_token" # from the prior step } response = requests.get(url, headers=headers) response.raise_for_status() response = response.json() ``` ```javascript const axios = require('axios'); const url = 'https://production.trackstarhq.com/wms/inventory'; ``` -------------------------------- ### Curl Example Source: https://docs.trackstarhq.com/how-to-guides/sandbox This snippet shows how to make a GET request to the Trackstar API using curl, including the necessary authentication headers. ```APIDOC ## GET /api/resource (Example - Curl) ### Description This command demonstrates how to retrieve a resource from the Trackstar API using curl, including the required authentication headers. ### Method GET ### Endpoint `/api/resource` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET \ 'YOUR_API_ENDPOINT/api/resource' \ -H 'x-trackstar-api-key: YOUR_API_KEY' \ -H 'x-trackstar-access-token: an_access_token' ``` ### Response #### Success Response (200) - **data** (object) - The requested resource data. #### Response Example ```json { "data": { "id": "123", "name": "Example Resource" } } ``` ``` -------------------------------- ### Listen for Server Connections in JavaScript Source: https://docs.trackstarhq.com/how-to-guides/getting-started This snippet shows how to start a server and listen for incoming connections on a specified port. It includes a callback function to log a message to the console once the server is running. This is a common pattern in Node.js applications. ```javascript app.listen(3000, () => { console.log('Server listening on port 3000'); }); ``` -------------------------------- ### POST /wms/products Source: https://docs.trackstarhq.com/api-reference/wms-api/inbound-shipments/info Create a new product within the WMS system. ```APIDOC ## POST /wms/products ### Description Create a new product. Refer to the integrations endpoint for required and optional fields. ### Method POST ### Endpoint /wms/products ### Request Body - **product_data** (object) - Required - Product details ### Response #### Success Response (200) - **id** (string) - The ID of the created product #### Response Example { "id": "prod_123" } ``` -------------------------------- ### POST /api-reference/wms-api/products/post Source: https://docs.trackstarhq.com/api-reference/mgmt/integrations Create a new product entry in the WMS system. ```APIDOC ## POST /api-reference/wms-api/products/post ### Description Creates a new product record in the warehouse management system. ### Method POST ### Endpoint /api-reference/wms-api/products/post ### Parameters #### Request Body - **sku** (string) - Required - Unique product identifier - **name** (string) - Required - Product name - **price** (number) - Optional - Product price ### Request Example { "sku": "NEW-SKU-01", "name": "Widget", "price": 19.99 } ### Response #### Success Response (201) - **id** (string) - The generated product ID #### Response Example { "id": "prod_abc789", "status": "created" } ``` -------------------------------- ### Trackstar API Authentication and Request Example Source: https://docs.trackstarhq.com/how-to-guides/getting-started This section demonstrates how to authenticate with the Trackstar API using an API key and access token, and how to make a GET request to retrieve data. ```APIDOC ## GET /api/data ### Description Retrieves data from the Trackstar API. Requires authentication via API key and access token. ### Method GET ### Endpoint /api/data ### Parameters #### Header Parameters - **x-trackstar-api-key** (string) - Required - Your Trackstar API key. - **x-trackstar-access-token** (string) - Required - The access token obtained from your database. - **Content-Type** (string) - Required - Should be set to "application/json". ### Request Example ```json { "x-trackstar-api-key": "TRACKSTAR_API_KEY", "x-trackstar-access-token": "ACCESS_TOKEN", # from your database that you stored in step 2.2 "Content-Type": "application/json" } ``` ### Response #### Success Response (200) - **data** (object) - The data returned from the API. #### Response Example ```json { "data": {} } ``` ### Code Example (Python) ```python import requests url = "/api/data" headers = { "x-trackstar-api-key": "TRACKSTAR_API_KEY", "x-trackstar-access-token": "ACCESS_TOKEN", # from your database that you stored in step 2.2 "Content-Type": "application/json" } response = requests.get(url, headers=headers) response.raise_for_status() data = response.json() # Make magic happen ``` ### Code Example (Node.js) ```javascript const axios = require('axios'); const url = '/api/data'; const headers = { 'x-trackstar-api-key': 'TRACKSTAR_API_KEY', 'x-trackstar-access-token': 'ACCESS_TOKEN', // from your database that you stored in step 2.2 'Content-Type': 'application/json' }; axios.get(url, { headers }) .then(response => { const data = response.data; // Make magic happen }) .catch(error => { console.error('Error fetching data:', error); }); ``` ``` -------------------------------- ### Initialize TrackstarHQ with Configuration (JavaScript) Source: https://docs.trackstarhq.com/how-to-guides/trackstar-link This JavaScript snippet demonstrates how to initialize the TrackstarHQ library. It includes setting up configuration options and an onLoad callback function. The code checks if the Trackstar object is available globally before proceeding with initialization. ```javascript window.Trackstar = window.Trackstar || {}; window.Trackstar.init({ // ... configuration options onLoad: () => { // ... callback logic } }); ``` -------------------------------- ### Inventory API Endpoint Source: https://docs.trackstarhq.com/how-to-guides/sandbox This section details how to retrieve inventory data using the Trackstar API. It includes an example using curl to make a GET request to the inventory endpoint, requiring authentication headers. ```APIDOC ## GET /wms/inventory ### Description Retrieves inventory data from the Trackstar WMS. ### Method GET ### Endpoint https://production.trackstarhq.com/wms/inventory ### Parameters #### Query Parameters None #### Headers - **x-trackstar-api-key** (string) - Required - Your Trackstar API key. - **x-trackstar-access-token** (string) - Required - An access token obtained through authentication. ### Request Example ```bash curl --request GET \ --url https://production.trackstarhq.com/wms/inventory \ --header 'x-trackstar-api-key: YOUR_API_KEY' \ --header 'x-trackstar-access-token: an_access_token' # from the prior step ``` ### Response #### Success Response (200) - **inventoryData** (object) - Contains the inventory details. #### Response Example ```json { "inventoryData": { "itemCount": 150, "items": [ { "sku": "WIDGET-001", "quantity": 100, "location": "A1" }, { "sku": "GADGET-002", "quantity": 50, "location": "B2" } ] } } ``` ``` -------------------------------- ### Get Link Token API Call (Shell) Source: https://docs.trackstarhq.com/how-to-guides/getting-started This snippet demonstrates how to obtain a link token by making a POST request to the /link/token endpoint using curl. This token is essential for authenticating with the Trackstar API and is a prerequisite for the embedded setup. ```shellscript curl -X POST https://api.trackstarhq.com/link/token \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### POST /wms/kits Source: https://docs.trackstarhq.com/how-to-guides/syncing-data Creates a new kit product in the WMS system. ```APIDOC ## POST /wms/kits ### Description Creates a new kit product. Refer to the integrations endpoint for required and optional fields. ### Method POST ### Endpoint /wms/kits ### Request Body - **kit_details** (object) - Required - The details of the kit to be created. ### Request Example { "name": "Starter Kit", "items": ["item_1", "item_2"] } ### Response #### Success Response (200) - **id** (string) - The unique identifier of the created kit. #### Response Example { "id": "kit_12345" } ``` -------------------------------- ### Install Trackstar Link Package (NPM) Source: https://docs.trackstarhq.com/llms-full.txt Installs the Trackstar Link component package for React or Angular using NPM. Ensure you have Node.js and NPM installed. ```bash npm install @trackstar/react-trackstar-link ``` ```bash npm install @trackstar/angular-trackstar-link ``` -------------------------------- ### Setting Up Webhook Transformations Source: https://docs.trackstarhq.com/llms-full.txt Instructions on how to configure and enable webhook transformations in the Trackstar Dashboard. ```APIDOC ## Setting Up Webhook Transformations To configure webhook transformations: 1. Navigate to the [Trackstar Dashboard](https://dashboard.trackstarhq.com/webhooks). 2. Click on your webhook endpoint to view its settings. 3. Go to the "Advanced" tab. 4. Locate the "Transformations" card. 5. Enable transformations and paste your custom JavaScript code. 6. Save your changes. For more information, see the [Svix Transformations documentation](https://docs.svix.com/transformations). ``` -------------------------------- ### Install Trackstar Link Package (Yarn) Source: https://docs.trackstarhq.com/llms-full.txt Installs the Trackstar Link component package for React or Angular using Yarn. Ensure you have Yarn installed and configured in your project. ```bash yarn add @trackstar/react-trackstar-link ``` ```bash yarn add @trackstar/angular-trackstar-link ``` -------------------------------- ### General API Guides Source: https://docs.trackstarhq.com/api-reference/wms-api/orders/attach-file Guides on general Trackstar API functionalities. ```APIDOC ## Writing Data ### Description Guide on how to write data to the Trackstar API. ### Method POST/PUT/PATCH ### Endpoint /how-to-guides/programmatic-writes ## Trackstar Tags ### Description Information on tagging objects within Trackstar. ### Method POST/PUT ### Endpoint /how-to-guides/trackstar-tags ## Passthrough Requests ### Description Guide on making passthrough requests to the Trackstar API. ### Method POST/GET ### Endpoint /how-to-guides/passthrough-requests ``` -------------------------------- ### Make Backend API Calls with Python Source: https://docs.trackstarhq.com/how-to-guides/getting-started Demonstrates how to use an access token and API key to perform authenticated requests to the Trackstar WMS inventory API using the requests library. ```python import requests TRACKSTAR_API_KEY = "" ACCESS_TOKEN = "" url = "https://production.trackstarhq.com/wms/inventory" headers = { ``` -------------------------------- ### Admin API: Get Magic Link Source: https://docs.trackstarhq.com/api-reference/wms-api/inventory/inventory-ledger Get a Magic Link by its ID. ```APIDOC ## GET /magic-links/{magic_link_id} ### Description Get a Magic Link by its ID. ### Method GET ### Endpoint /magic-links/{magic_link_id} ### Parameters #### Path Parameters - **magic_link_id** (string) - Required - The ID of the Magic Link to retrieve. ### Request Example (No request example specified in the provided text) ### Response #### Success Response (200) (No success response details specified in the provided text) #### Response Example (No response example specified in the provided text) ``` -------------------------------- ### Configure API Request Headers and Execute Call Source: https://docs.trackstarhq.com/how-to-guides/getting-started Demonstrates how to set up authentication headers, including API keys and access tokens, and perform a GET request to the Trackstar API. ```python headers = { "x-trackstar-api-key": TRACKSTAR_API_KEY, "x-trackstar-access-token": ACCESS_TOKEN, # from your database that you stored in step 2.2 "Content-Type": "application/json" } response = requests.get(url, headers=headers) response.raise_for_status() response = response.json() # Make magic happen ``` ```javascript const axios = require('axios'); const headers = { 'x-trackstar-api-key': TRACKSTAR_API_KEY, 'x-trackstar-access-token': ACCESS_TOKEN, 'Content-Type': 'application/json' }; const response = await axios.get(url, { headers }); ``` -------------------------------- ### Get All Products Source: https://docs.trackstarhq.com/llms-full.txt Retrieves all Products for the WMS connection associated with the provided access token. ```APIDOC ## GET /wms/products ### Description Returns all Products for the WMS connection associated with the provided access token. ### Method GET ### Endpoint /wms/products ### Parameters #### Query Parameters - **access_token** (string) - Required - The access token for WMS connection authentication. ``` -------------------------------- ### Inbound Shipment Webhook Example Source: https://docs.trackstarhq.com/how-to-guides/webhooks This example demonstrates the structure of an inbound shipment webhook notification, showing attribute changes. ```APIDOC ## POST /webhooks/inbound_shipment ### Description This endpoint receives notifications for inbound shipment events, such as updates to status or received quantities. ### Method POST ### Endpoint /webhooks/inbound_shipment ### Request Body - **event_type** (string) - Required - The type of event that occurred (e.g., "inbound_shipment.updated"). - **integration_name** (string) - Required - The name of the integration that triggered the event. - **purchase_order_number** (string) - Required - The purchase order number associated with the shipment. - **status** (string) - Required - The current status of the shipment (e.g., "received"). - **supplier** (string) - Required - The supplier of the shipment. - **updated_date** (string) - Required - The date and time when the shipment was updated (ISO 8601 format). - **warehouse_id** (string) - Required - The ID of the warehouse where the shipment is located. - **previous_attributes** (object) - Optional - Contains the previous values of attributes that have changed. - **status** (string) - The previous status of the shipment. - **line_items** (array) - An array of previous line item details. - **received_quantity** (integer) - The previous received quantity for a line item. ### Request Example ```json { "event_type": "inbound_shipment.updated", "integration_name": "integration_name", "purchase_order_number": "PO#", "status": "received", "supplier": "supplier", "updated_date": "2023-06-14T15:36:48Z", "warehouse_id": "warehouse_id", "previous_attributes": { "status": "open", "line_items": [ { "received_quantity": 1 } ] } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the webhook was received. #### Response Example ```json { "message": "Webhook received successfully." } ``` **Note**: In the example above, `status` changed from “open” to “received” and the `received_quantity` of the second line item changed from 1 to 2. `line_items.1.received_quantity` is referring to `data.line_items[1].received_quantity`. ``` -------------------------------- ### Install React Trackstar Link Package Source: https://docs.trackstarhq.com/llms-full.txt Commands to install the official react-trackstar-link package in your frontend project using npm or yarn. ```bash npm install @trackstar/react-trackstar-link ``` ```bash yarn add @trackstar/react-trackstar-link ``` -------------------------------- ### Get Product Information via API Source: https://docs.trackstarhq.com/api-reference/wms-api/products/get-item This snippet demonstrates how to retrieve detailed information for a specific product using the WMS API. It requires authentication headers and specifies the product ID in the URL. The response includes comprehensive product data, inventory details, supplier information, and custom tags. ```bash curl --request GET \ --url https://production.trackstarhq.com/wms/products/{product_id} \ --header 'x-trackstar-access-token: ' \ --header 'x-trackstar-api-key: ' ``` -------------------------------- ### Get Inbound Shipment API Reference (JavaScript) Source: https://docs.trackstarhq.com/api-reference/wms-api/inbound-shipments/get-item This snippet defines metadata for an API endpoint '/wms/inbound-shipments/{inbound_shipment_id}'. It specifies the HTTP method (GET), the operation title ('Get Inbound Shipment'), a description, and the corresponding URL path. This is likely used for generating API documentation. ```javascript { "openapi": "get /wms/inbound-shipments/{inbound_shipment_id}", "title": "Get Inbound Shipment", "description": "Returns a single Inbound Shipment for the WMS connection with the associated inbound shipment id.", "href": "/api-reference/wms-api/inbound-shipments/get-item" } ``` -------------------------------- ### Returns API Source: https://docs.trackstarhq.com/api-reference/wms-api/inventory/get Manage product returns within the WMS. ```APIDOC ## GET /wms/returns ### Description Returns all Returns for the WMS connection associated with the provided access token. ### Method GET ### Endpoint /wms/returns ### Parameters #### Query Parameters - **access_token** (string) - Required - The access token for WMS connection. ### Response #### Success Response (200) - **returns** (array) - A list of returns. - **id** (integer) - The ID of the return. - **status** (string) - The current status of the return. - **created_at** (string) - The timestamp when the return was initiated. #### Response Example ```json { "returns": [ { "id": 301, "status": "Pending Inspection", "created_at": "2023-10-27T09:00:00Z" }, { "id": 302, "status": "Completed", "created_at": "2023-10-25T14:00:00Z" } ] } ``` ``` ```APIDOC ## GET /wms/returns/{return_id} ### Description Returns a single Return for the WMS connection with the associated return id. ### Method GET ### Endpoint /wms/returns/{return_id} ### Parameters #### Path Parameters - **return_id** (integer) - Required - The ID of the return to retrieve. ### Response #### Success Response (200) - **id** (integer) - The ID of the return. - **status** (string) - The current status of the return. - **reason** (string) - The reason for the return. - **items** (array) - A list of items included in the return. #### Response Example ```json { "id": 301, "status": "Pending Inspection", "reason": "Damaged item", "items": [ { "sku": "ITEM003", "quantity": 1 } ] } ``` ``` ```APIDOC ## POST /wms/returns ### Description Create a return. Get the required, optional, and integration specific fields by calling the [integrations](/api-reference/mgmt/integrations) endpoint. ### Method POST ### Endpoint /wms/returns ### Parameters #### Request Body - **return_details** (object) - Required - Details of the return. - **order_id** (integer) - Required - The ID of the original order. - **reason** (string) - Required - The reason for the return. - **items** (array) - Required - A list of items being returned. - **sku** (string) - Required - The SKU of the item. - **quantity** (integer) - Required - The quantity of the item being returned. ### Request Example ```json { "return_details": { "order_id": 123, "reason": "Wrong item received", "items": [ { "sku": "ITEM004", "quantity": 2 } ] } } ``` ### Response #### Success Response (200) - **id** (integer) - The ID of the newly created return. - **status** (string) - The initial status of the return. #### Response Example ```json { "id": 303, "status": "Received" } ``` ``` ```APIDOC ## PUT /wms/returns/{return_id} ### Description Update a return. Get the required, optional, and integration specific fields by calling the [integrations](/api-reference/mgmt/integrations) endpoint. ### Method PUT ### Endpoint /wms/returns/{return_id} ### Parameters #### Path Parameters - **return_id** (integer) - Required - The ID of the return to update. #### Request Body - **update_details** (object) - Required - The details to update for the return. - **status** (string) - Optional - The new status for the return. - **reason** (string) - Optional - The updated reason for the return. ### Request Example ```json { "update_details": { "status": "Processing Refund" } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of the update. #### Response Example ```json { "message": "Return ID 301 updated successfully." } ``` ``` ```APIDOC ## PUT /wms/returns/{return_id}/cancel ### Description Cancel a return for the WMS connection with the associated return id. ### Method PUT ### Endpoint /wms/returns/{return_id}/cancel ### Parameters #### Path Parameters - **return_id** (integer) - Required - The ID of the return to cancel. ### Response #### Success Response (200) - **message** (string) - Confirmation message that the return has been cancelled. #### Response Example ```json { "message": "Return ID 301 has been successfully cancelled." } ``` ``` ```APIDOC ## PUT /wms/returns/{return_id}/trackstar-tags ### Description Update the trackstar tags for the specified return. ### Method PUT ### Endpoint /wms/returns/{return_id}/trackstar-tags ### Parameters #### Path Parameters - **return_id** (integer) - Required - The ID of the return to update. #### Request Body - **trackstar_tags** (array) - Required - A list of trackstar tags to associate with the return. - **tag** (string) - The trackstar tag. ### Request Example ```json { "trackstar_tags": [ { "tag": "escalated" } ] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of the update. #### Response Example ```json { "message": "Trackstar tags updated successfully for return ID 301." } ``` ``` -------------------------------- ### POST /sandbox/generate-sandbox/{integration_type} Source: https://docs.trackstarhq.com/api-reference/mgmt/exchange-auth-code Generates a sandbox with mocked out data for testing. ```APIDOC ## POST /sandbox/generate-sandbox/{integration_type} ### Description Generates a sandbox with mocked out data. Uses the same connection ID every time, and will reset any existing sandbox. ### Method POST ### Endpoint /sandbox/generate-sandbox/{integration_type} ### Parameters #### Path Parameters - **integration_type** (string) - Required - The type of integration to generate a sandbox for. ``` -------------------------------- ### Get Connections - API Endpoint Source: https://docs.trackstarhq.com/api-reference/mgmt/sync-connection This entry represents the API endpoint for retrieving a list of connections. It is a GET request and is part of the management API. ```api GET /api-reference/mgmt/get-connections ``` -------------------------------- ### Get Connection - API Endpoint Source: https://docs.trackstarhq.com/api-reference/mgmt/sync-connection This entry represents the API endpoint for retrieving details of a single connection. It is a GET request and is part of the management API. ```api GET /api-reference/mgmt/get-connection ``` -------------------------------- ### Initialize Express and Axios in Node.js Source: https://docs.trackstarhq.com/how-to-guides/getting-started This code imports the necessary modules, initializes the Express application, and sets up the JSON body parsing middleware. It also defines a placeholder for the TRACKSTAR_API_KEY. ```javascript const express = require('express'); const axios = require('axios'); const app = express(); const TRACKSTAR_API_KEY = ''; app.use(express.json()); ``` -------------------------------- ### Connection Permissions Source: https://docs.trackstarhq.com/llms-full.txt Explanation of connection permissions and how to handle missing permissions. ```APIDOC # Connection Permissions Per-Connection Permissions When a connection is installed in Trackstar, it will most likely look like this: Full Permissions Occasionally, however, the connection may not be fully able to access all the aspects of the underlying system. In that case, you may see these in your [Trackstar Link](/how-to-guides/trackstar-link) or under the Sync Errors tab in the UI: Missing Permissions You will also receive a `connection-error.created` [webhook](/how-to-guides/webhooks) and see a populated `errors` array when [querying connections](/api-reference/mgmt/get-connections). ## Reinstalling a Connection Some systems can be updated to provide the necessary permissions. (e.g. updating the user's role in the WMS) Others may require a full reinstallation of the connection. There are three ways to reinstall a connection: * In the [Trackstar Dashboard](https://dashboard.trackstarhq.com/connections) by clicking the "Reinstall Connection" button within the connection row * By generating a [magic link](/how-to-guides/trackstar-link#sending-a-magic-link) with the `Reinstall Connection Id (Optional)` field filled in * Or by sending the `connection_id` when [generating your user's link token](/api-reference/mgmt/create-link-token) in the embedded Trackstar Link flow Reinstall The connection will be reinstalled with the same ID and new credentials, and no historical data will be lost. ``` -------------------------------- ### Get Magic Links - API Endpoint Source: https://docs.trackstarhq.com/api-reference/mgmt/sync-connection This entry represents the API endpoint for retrieving a list of magic links. It is a GET request and is part of the management API. ```api GET /api-reference/mgmt/get-magic-links ```