The Bricklink PowerShell Module provides a suite of tools for interacting with the Bricklink API, enabling automation and management of Bricklink resources such as inventory, wanted lists, and order management.
Before using this module, you must have:
-
PowerShell 7 or later installed on your system.
-
A Bricklink account to access the Bricklink API.
-
Additionally, you need to obtain API keys from Bricklink by registering your application in the Bricklink API Developer website. The following API credentials are required:
- Consumer Key
- Consumer Secret
- Token Value
- Token Secret
- Clone the repository from GitHub or install the module from the PowerShell Gallery by running
Install-Module Bricklink
. - Copy the configuration.example.json file to configuration.json and fill in your Bricklink API keys and other relevant information.
- Load the module with Import-Module ./Bricklink (adjust the path according to where you placed the module).
The Bricklink module communicates with Bricklink in two different ways; via the API and also via the web for wanted list management.
To use any function that depends on the API which is all functions not related to wanted lists, you must use the Save-BlBricklinkConfiguration command to save your initial API information securely by running the following commands in PowerShell, replacing with your actual API credentials:
Save-BlBricklinkConfiguration -Name "ConsumerKey" -Value "<your_consumer_key>"
Save-BlBricklinkConfiguration -Name "ConsumerSecret" -Value "<your_consumer_secret>"
Save-BlBricklinkConfiguration -Name "TokenValue" -Value "<your_token_value>"
Save-BlBricklinkConfiguration -Name "TokenSecret" -Value "<your_token_secret>"
To work with wanted lists, you must also provide your Bricklink store username and password.
Save-BlBricklinkConfiguration -Name "username" -Value "<username>"
Save-BlBricklinkConfiguration -Name "password" -Value "<password>"
This information is stored securely and is used by the module to authenticate your API requests.
After the initial setup and configuration, you can begin using the module to interact with the Bricklink API. Here are a few examples of what you can do:
- Get a list of categories: Get-BlCategoryList
- Add an item to a wanted list: Add-BlWantedListItem -WantedListId -ItemNo "<item_no>" -Qty -ColorId <color_id>
- Get price guide information for an item: Get-BlPriceGuide -Type "" -No "" -NewOrUsed "N" -GuideType "sold" -CountryCode "US"
For detailed information on each cmdlet and its parameters, refer to the cmdlet help within PowerShell.
Contributions to the Bricklink PowerShell Module are welcome! Please submit pull requests or issues through GitHub.