MarketplaceAPI.psm1
<#
.SYNOPSIS POST /GetSessionToken Returns a session token. (getSessionTokenPost) .DESCRIPTION Returns a session token. Authentication is sessions based. Note that for other API calls, the requester must provide a valid session token in the Authenticate field of each request (see example above). A session has access to the same resources and capabilities as the given user. MFA users are not supported. If you want to use some user for authentication, consider disabling MFA for this user. Individual user exceptions can be found under Company->Security->Enforced Multi-Factor Authentication .EXAMPLE PS C:\> Get-MarketplaceSessionToken .NOTES Return type String #> function Get-MarketplaceSessionToken { [CmdletBinding()] [OutputType([string])] param () # Check if environment variables are set if (-not $env:MARKETPLACE_BASE_URL -or -not $env:MARKETPLACE_USERNAME -or -not $env:MARKETPLACE_PASSWORD) { Write-Error "One or more required environment variables (MARKETPLACE_BASE_URL, MARKETPLACE_USERNAME, MARKETPLACE_PASSWORD) are not set. Use Set-MarketplaceAPIEnvironmentVariables to set them." return } $baseUrl = $env:MARKETPLACE_BASE_URL $authUrl = "$baseUrl/GetSessionToken" $body = @{ username = $env:MARKETPLACE_USERNAME password = $env:MARKETPLACE_PASSWORD } | ConvertTo-Json try { $response = Invoke-RestMethod -Uri $authUrl -Method Post -ContentType "application/json; charset=UTF-8" -Body $body return $response } catch { Write-Error "Failed to retrieve session token: $_" } } <# .SYNOPSIS Sets up the environment variables used for authentication .DESCRIPTION Environment variables: MARKETPLACE_BASE_URL MARKETPLACE_USERNAME MARKETPLACE_PASSWORD .PARAMETER BaseUrl https://marketplacetest.ccpaas.net/SimpleAPI/SimpleAPIService.svc/rest .PARAMETER Username api.user@marketplace.com .PARAMETER Password Password as string .EXAMPLE PS C:\> Set-MarketplaceAPIEnvironmentVariables -BaseUrl 'https://marketplacetest.ccpaas.net/SimpleAPI/SimpleAPIService.svc/rest' -Username 'api.user@marketplace.com' -Password 'SuperSecretPassword' .NOTES None of the variables are encrypted, only run on secure system. #> function Set-MarketplaceAPIEnvironmentVariables { [CmdletBinding()] [OutputType([string])] param ( [Parameter(Mandatory = $true)] [string]$BaseUrl, [Parameter(Mandatory = $true)] [string]$Username, [Parameter(Mandatory = $true)] [String]$Password ) [System.Environment]::SetEnvironmentVariable('MARKETPLACE_BASE_URL', $BaseUrl, [System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable('MARKETPLACE_USERNAME', $Username, [System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable('MARKETPLACE_PASSWORD', $Password, [System.EnvironmentVariableTarget]::Machine) Write-Output "Environment variables for Marketplace API have been set." } <# .SYNOPSIS Retrieves the latest invoices from the Marketplace API. .DESCRIPTION The Get-MarketplaceLatestInvoices function fetches the most recent invoices generated for the account associated with the provided session token. This function is essential for financial management, allowing users to view their latest billing information directly from the Marketplace. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. This token represents the authenticated session of the user. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $latestInvoices = Get-MarketplaceLatestInvoices -SessionToken $sessionToken This example retrieves the latest invoices using a session token obtained beforehand. It outputs the invoice details, including amounts, services billed, and other relevant billing information. .NOTES The API response includes detailed invoice data, such as service names, quantities, prices, and total amounts. This function is part of a suite of PowerShell cmdlets designed to facilitate interaction with the Marketplace API, enabling efficient management of subscriptions, billing, and user accounts within the Marketplace environment. #> function Get-MarketplaceLatestInvoices { [CmdletBinding()] [OutputType([string])] param ( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $false)] [bool]$GroupByDepartments = $false ) $baseUrl = $env:MARKETPLACE_BASE_URL $invoiceUrl = "$baseUrl/GetLatestInvoices" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ "groupByDepartments" = $GroupByDepartments } | ConvertTo-Json $response = Invoke-RestMethod -Uri $invoiceUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves invoices for a specific period from the Marketplace API. .DESCRIPTION The Get-MarketplaceLatestInvoicesForPeriod function fetches invoices generated within a specified year and month for the account associated with the provided session token. Optionally, invoices can be grouped by departments. This function is useful for financial review and reconciliation tasks, allowing users to access billing information for a specific billing period. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER Year The year for which invoices are being requested, formatted as a four-digit number (e.g., "2023"). .PARAMETER Month The month for which invoices are being requested, formatted as a two-digit number (e.g., "01" for January). .PARAMETER GroupByDepartments An optional boolean flag indicating whether to group invoices by departments. The default value is $false. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $invoicesForPeriod = Get-MarketplaceLatestInvoicesForPeriod -SessionToken $sessionToken -Year "2023" -Month "01" This example retrieves the invoices for January 2023 using a session token obtained beforehand. .EXAMPLE Get-MarketplaceLatestInvoicesForPeriod -SessionToken "yourSessionTokenHere" -Year "2023" -Month "02" -GroupByDepartments $true Directly uses a session token to fetch invoices for February 2023, grouped by departments. This method is beneficial for users needing detailed organizational billing insights. .NOTES Ensure the Year and Month parameters are correctly formatted to avoid errors. The API's response includes detailed invoice data for the specified period, potentially enhancing financial management and reporting capabilities within the Marketplace environment. #> function Get-MarketplaceLatestInvoicesForPeriod { [CmdletBinding()] [OutputType([array])] param ( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [string]$Year, [Parameter(Mandatory = $true)] [string]$Month, [Parameter(Mandatory = $false)] [bool]$GroupByDepartments = $false ) $baseUrl = $env:MARKETPLACE_BASE_URL $invoiceUrl = "$baseUrl/GetLatestInvoicesForPeriod" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ "year" = $Year "month" = $Month "groupByDepartments" = $GroupByDepartments } | ConvertTo-Json $response = Invoke-RestMethod -Uri $invoiceUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves preview invoices for the current billing period from the Marketplace API. .DESCRIPTION The Get-MarketplacePreviewInvoices function fetches preview invoices for the current, not yet closed billing period for the account associated with the provided session token. This function is particularly useful for financial forecasting and early review of expected charges. Preview invoices provide an estimate of the billing information before the final invoice generation. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER GroupByDepartments An optional boolean flag indicating whether to group the preview invoices by departments. This can provide a more detailed view of the billing information for different departments within an organization. The default value is $false. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $previewInvoices = Get-MarketplacePreviewInvoices -SessionToken $sessionToken This example retrieves the preview invoices for the current billing period using a session token obtained beforehand, without grouping by departments. .EXAMPLE Get-MarketplacePreviewInvoices -SessionToken "yourSessionTokenHere" -GroupByDepartments $true Uses a session token directly to fetch preview invoices for the current billing period, grouped by departments. This method is useful for administrators needing to review and manage billing information across different organizational units. .NOTES Preview invoices are estimates and may not reflect the final billed amounts. They are generated to provide an early insight into the expected charges for the current billing period. It's important to review the final invoices for accurate billing details once they are available. #> function Get-MarketplacePreviewInvoices { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $false)] [bool]$GroupByDepartments = $false ) $baseUrl = $env:MARKETPLACE_BASE_URL $invoiceUrl = "$baseUrl/GetPreviewInvoices" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ "groupByDepartments" = $GroupByDepartments } | ConvertTo-Json $response = Invoke-RestMethod -Uri $invoiceUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves a list of available reports for the current user from the Marketplace API. .DESCRIPTION The Get-MarketplaceReports function fetches a list of reports that the authenticated user can access or generate through the Marketplace API. This function requires a valid session token, which can be obtained using the Get-MarketplaceSessionToken function. The list includes report names and descriptions, allowing users to identify which reports they can request for detailed data. .PARAMETER SessionToken The session token for authenticating with the Marketplace API. This token represents the authenticated session of the user and is used to authorize the request to get available reports. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $availableReports = Get-MarketplaceReports -SessionToken $sessionToken This example first retrieves a session token using Get-MarketplaceSessionToken and then uses that token to get a list of available reports from the Marketplace API. .EXAMPLE Get-MarketplaceReports -SessionToken "yourSessionTokenHere" Directly uses a session token (replace "yourSessionTokenHere" with your actual session token) to fetch available reports. This is useful if you've stored your session token in a variable or if you're reusing a session token for multiple requests within its valid period. .NOTES Ensure that the session token passed to this function is valid and has not expired. Tokens typically have a limited lifetime for security reasons. If you encounter authentication errors, obtain a new session token using the Get-MarketplaceSessionToken function. This function is part of a set of cmdlets designed for interacting with the Marketplace API, allowing for automation and integration of Marketplace operations within PowerShell scripts. #> function Get-MarketplaceReports { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string]$SessionToken ) $baseUrl = $env:MARKETPLACE_BASE_URL $reportsUrl = "$baseUrl/GetReports" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ } | ConvertTo-Json $response = Invoke-RestMethod -Uri $reportsUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Executes a specified report within the Marketplace API. .DESCRIPTION The Invoke-MarketplaceExecuteReport function allows users to execute a specific report by its name, as available in the Marketplace API. It requires a valid session token and takes parameters specific to the report being executed. This cmdlet enables the automation of report generation and retrieval, facilitating the analysis of various data points provided by the Marketplace. .PARAMETER SessionToken A valid session token obtained from the Marketplace API that authorizes the user to execute reports. .PARAMETER ReportName The name of the report to be executed. Report names can be obtained using the Get-MarketplaceReports function. .PARAMETER Parameters An optional hashtable of parameters required by the report. Each key-value pair in the hashtable corresponds to a specific report parameter. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $reportName = "SalesReport" $parameters = @{ StartDate = '2021-01-01'; EndDate = '2021-01-31' } Invoke-MarketplaceExecuteReport -SessionToken $sessionToken -ReportName $reportName -Parameters $parameters This example executes a "SalesReport" for the month of January 2021, using a session token obtained beforehand. The report's required parameters, such as the start and end dates, are provided in a hashtable. .EXAMPLE Invoke-MarketplaceExecuteReport -SessionToken "yourSessionTokenHere" -ReportName "CustomerActivity" -Parameters @{ CustomerId = '12345' } Executes the "CustomerActivity" report for a specific customer ID, directly using a session token. Replace "yourSessionTokenHere" with an actual session token and adjust the CustomerId parameter as needed. .NOTES Before invoking a report, ensure you have the correct report name and understand the required parameters. Some reports might require specific data formats or value ranges. If you encounter any errors during execution, verify the parameters and ensure your session token is valid. For more detailed information on available reports and their parameters, refer to the Get-MarketplaceReports function documentation or the Marketplace API documentation. #> function Invoke-MarketplaceExecuteReport { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [string]$ReportName, [Parameter(Mandatory = $false)] [hashtable]$Parameters ) $baseUrl = $env:MARKETPLACE_BASE_URL $executeReportUrl = "$baseUrl/ExecuteReport" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ reportName = $ReportName parameters = $Parameters } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri $executeReportUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Creates a new subscription in the Marketplace API. .DESCRIPTION The New-MarketplaceSubscription function creates a new subscription for a service in the Marketplace. This function requires a valid session token, details of the subscription to be created, the parent account ID under which the subscription will be created, and the name of the service for which the subscription is being created. .PARAMETER SessionToken A valid session token that authorizes the user to create subscriptions in the Marketplace. .PARAMETER SubscriptionDetails A hashtable containing the details of the subscription to be created. The keys and values in this hashtable depend on the specific service for which the subscription is being created. .PARAMETER ParentAccountId The account ID of the parent account under which the new subscription will be created. This could be the ID of a reseller or a customer account, depending on the context. .PARAMETER ServiceName The name of the service for which the subscription is being created. Service names can be obtained using the Get-MarketplaceServices or similar functions. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $subscriptionDetails = @{ "NumberOfLicenses" = 10 "LicenseType" = "Premium" } $parentAccountId = 123456 $serviceName = "CloudServicePremium" New-MarketplaceSubscription -SessionToken $sessionToken -SubscriptionDetails $subscriptionDetails -ParentAccountId $parentAccountId -ServiceName $serviceName This example creates a new subscription for 10 premium licenses of the "CloudServicePremium" service under the parent account with ID 123456, using a previously obtained session token. .EXAMPLE $details = @{ "Plan" = "BasicPlan" "StartDate" = "2023-01-01" } New-MarketplaceSubscription -SessionToken "yourSessionToken" -SubscriptionDetails $details -ParentAccountId 78910 -ServiceName "WebHostingBasic" Creates a new subscription for the "WebHostingBasic" service with the "BasicPlan" starting from "2023-01-01", using a direct session token string. .NOTES The structure and content of the SubscriptionDetails parameter vary based on the service. Refer to the Marketplace API documentation for detailed information on required fields for different services. Ensure that all mandatory fields for the chosen service are included in the SubscriptionDetails hashtable to avoid errors during subscription creation. #> function New-MarketplaceSubscription { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [hashtable]$SubscriptionDetails, [Parameter(Mandatory = $true)] [int]$ParentAccountId, [Parameter(Mandatory = $true)] [string]$ServiceName ) $baseUrl = $env:MARKETPLACE_BASE_URL $createUrl = "$baseUrl/CreateSubscription" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ ParentAccountId = $ParentAccountId ServiceName = $ServiceName Fields = @($SubscriptionDetails.GetEnumerator() | ForEach-Object { @{ Name = $_.Key; Value = $_.Value } }) } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri $createUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Updates an existing subscription in the Marketplace API. .DESCRIPTION The Set-MarketplaceSubscription function updates an existing subscription within the Marketplace. This requires a valid session token, the account ID of the subscription to be updated, and a hashtable detailing the changes to be made. .PARAMETER SessionToken A valid session token that authorizes the user to update subscriptions in the Marketplace. .PARAMETER AccountId The account ID of the subscription that needs to be updated. This ID uniquely identifies the subscription within the Marketplace. .PARAMETER UpdatedFields A hashtable containing the details of the updates to be made to the subscription. Each key-value pair in the hashtable represents a field to update and its new value. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $accountId = 987654 $updatedFields = @{ "NumberOfLicenses" = 15 } Set-MarketplaceSubscription -SessionToken $sessionToken -AccountId $accountId -UpdatedFields $updatedFields This example updates the number of licenses for a subscription (with account ID 987654) to 15, using a session token obtained previously. .EXAMPLE Set-MarketplaceSubscription -SessionToken "yourSessionTokenHere" -AccountId 123456 -UpdatedFields @{ "Plan" = "EnterprisePlan" } Directly uses a session token to update the plan of a subscription (with account ID 123456) to "EnterprisePlan". .NOTES It's important to know the exact field names and acceptable values for the subscription you are updating. Incorrect field names or values can lead to errors. Before attempting to update a subscription, consider retrieving its current state with Get-MarketplaceSubscription to understand which fields are available and need updating. This function is part of a larger suite of cmdlets designed for interacting with the Marketplace API, enabling comprehensive management of Marketplace resources. #> function Set-MarketplaceSubscription { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$AccountId, [Parameter(Mandatory = $true)] [hashtable]$UpdatedFields ) $baseUrl = $env:MARKETPLACE_BASE_URL $updateUrl = "$baseUrl/UpdateSubscription" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ AccountId = $AccountId Fields = @($UpdatedFields.GetEnumerator() | ForEach-Object { @{ Name = $_.Key; Value = $_.Value } }) } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri $updateUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves details of a specific subscription from the Marketplace API. .DESCRIPTION The Get-MarketplaceSubscription function fetches detailed information about a specific subscription within the Marketplace, using its account ID. This function requires a valid session token to authorize the request. .PARAMETER SessionToken A session token obtained from the Marketplace API, which is used to authenticate the request to retrieve subscription details. .PARAMETER AccountId The unique account ID of the subscription for which details are being requested. This ID is used to identify the specific subscription within the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $accountId = 123456 $subscriptionDetails = Get-MarketplaceSubscription -SessionToken $sessionToken -AccountId $accountId This example retrieves the details of the subscription with account ID 123456, using a session token obtained beforehand. The details include subscription status, plan, number of licenses, and other relevant information. .EXAMPLE Get-MarketplaceSubscription -SessionToken "yourSessionTokenHere" -AccountId 654321 Directly uses a session token to fetch details of the subscription with account ID 654321. This approach is useful when you already have the session token and the subscription account ID ready. .NOTES Ensure the account ID corresponds to an existing subscription in the Marketplace. If the provided ID does not match any subscription, or if the session token is invalid or expired, the request will fail. To manage subscriptions effectively, consider using other cmdlets in this module, such as New-MarketplaceSubscription or Set-MarketplaceSubscription, for creating and updating subscriptions, respectively. #> function Get-MarketplaceSubscription { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$AccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getUrl = "$baseUrl/GetSubscription" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $AccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves a list of all subscriptions under a specified parent account from the Marketplace API. .DESCRIPTION The Get-MarketplaceSubscriptions function lists all subscriptions associated with a given parent account. This includes subscriptions for all services under that account. A valid session token is required to authenticate and authorize the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. The token represents the authenticated session of the user. .PARAMETER ParentAccountId The account ID of the parent account for which the list of subscriptions is being requested. This ID uniquely identifies the parent account in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $parentAccountId = 78910 $subscriptions = Get-MarketplaceSubscriptions -SessionToken $sessionToken -ParentAccountId $parentAccountId This example fetches a list of all subscriptions under the parent account with ID 78910, using a previously obtained session token. .EXAMPLE Get-MarketplaceSubscriptions -SessionToken "yourSessionTokenHere" -ParentAccountId 12345 Uses a session token directly to retrieve all subscriptions associated with the parent account ID 12345. This method is convenient when the session token and parent account ID are already known or stored. .NOTES The returned list includes detailed information about each subscription, such as service name, subscription status, plan details, and more. This function is useful for account management purposes, allowing administrators to overview and manage all subscriptions under their purview. It complements other cmdlets designed for subscription manipulation, like New-MarketplaceSubscription and Set-MarketplaceSubscription. #> function Get-MarketplaceSubscriptions { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$ParentAccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $listUrl = "$baseUrl/GetSubscriptions" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ parentAccountId = $ParentAccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $listUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves details of a specific subscription and its addons from the Marketplace API. .DESCRIPTION The Get-MarketplaceSubscriptionWithAddons function fetches detailed information about a specific subscription, including information about any addons associated with that subscription. This function is particularly useful for subscriptions that have additional services or features added on top of the base subscription. A valid session token is required to authorize the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, which is used to authenticate the request. This token represents the authenticated session of the user. .PARAMETER AccountId The unique account ID of the subscription for which details, including addons, are being requested. This ID is used to identify the specific subscription within the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $accountId = 123456 $subscriptionDetailsWithAddons = Get-MarketplaceSubscriptionWithAddons -SessionToken $sessionToken -AccountId $accountId This example retrieves the details of the subscription with account ID 123456, including its associated addons, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceSubscriptionWithAddons -SessionToken "yourSessionTokenHere" -AccountId 654321 Directly uses a session token to fetch details of the subscription with account ID 654321 and its addons. This approach is useful when you already have the session token and the subscription account ID ready. .NOTES This function is essential for understanding the full scope of services and features a subscription encompasses, including any additional addons. It allows for comprehensive management and oversight of subscriptions within the Marketplace. Ensure the account ID corresponds to an existing subscription to avoid errors. If the session token is invalid or expired, the request will fail, necessitating a new session token. #> function Get-MarketplaceSubscriptionWithAddons { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$AccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getUrlWithAddons = "$baseUrl/GetSubscriptionWithAddons" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $AccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getUrlWithAddons -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Creates a new company profile in the Marketplace API. .DESCRIPTION The New-MarketplaceCompany function facilitates the creation of a new company profile within the Marketplace. This function is essential for administrators or partners who manage multiple companies and need to onboard a new company into the Marketplace platform. It requires a valid session token and a hashtable of company details as input. .PARAMETER SessionToken A valid session token that authorizes the user to create a new company in the Marketplace. The session token must be obtained through authentication with the Marketplace API. .PARAMETER CompanyDetails A hashtable containing the details of the company to be created. The hashtable should include key-value pairs for necessary company information such as company name, VAT ID, email, address, and other relevant details as required by the Marketplace API. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $companyDetails = @{ "CompanyName" = "Example Company Inc." "VATID" = "EU123456789" "Email" = "info@examplecompany.com" "Address" = "123 Example Street" "City" = "Example City" "Country" = "Example Country" "Zip" = "12345" } New-MarketplaceCompany -SessionToken $sessionToken -CompanyDetails $companyDetails This example creates a new company profile for "Example Company Inc." with the provided details, using a previously obtained session token. .NOTES The exact requirements for the CompanyDetails hashtable may vary depending on the Marketplace platform's specific needs. It's important to consult the Marketplace API documentation to ensure all required company information is provided correctly. This function is part of a suite of PowerShell cmdlets designed to interact with the Marketplace API, enabling efficient management of companies, subscriptions, and more within the Marketplace ecosystem. #> function New-MarketplaceCompany { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [hashtable]$CompanyDetails ) $baseUrl = $env:MARKETPLACE_BASE_URL $createCompanyUrl = "$baseUrl/CreateCompany" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = $CompanyDetails | ConvertTo-Json $response = Invoke-RestMethod -Uri $createCompanyUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves a list of companies under a specified parent account from the Marketplace API. .DESCRIPTION The Get-MarketplaceCompanies function lists all companies that are associated with a given parent account within the Marketplace. This function is useful for administrators or partners who need to manage or review the companies under their purview. It requires a valid session token to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, which is used to authenticate the request. This token represents the authenticated session of the user. .PARAMETER ParentAccountId The account ID of the parent account for which the list of companies is being requested. This ID uniquely identifies the parent account in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $parentAccountId = 78910 $companies = Get-MarketplaceCompanies -SessionToken $sessionToken -ParentAccountId $parentAccountId This example fetches a list of all companies under the parent account with ID 78910, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceCompanies -SessionToken "yourSessionTokenHere" -ParentAccountId 12345 Directly uses a session token to retrieve all companies associated with the parent account ID 12345. This method is convenient when the session token and parent account ID are already known or stored. .NOTES The returned list includes basic information about each company, such as the company name, VAT ID, and contact details. This function complements other cmdlets designed for company manipulation, like New-MarketplaceCompany and Set-MarketplaceCompany, facilitating comprehensive management of companies within the Marketplace. #> function Get-MarketplaceCompanies { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$ParentAccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getCompaniesUrl = "$baseUrl/GetCompanies" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ parentAccountId = $ParentAccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getCompaniesUrl -Method Post -ContentType "application/json; charset=UTF-8; charset=utf-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves the credit limit for a specific company from the Marketplace API. .DESCRIPTION The Get-MarketplaceCompanyCreditLimit function fetches the credit limit set for a specific company. This is crucial for understanding the financial boundaries set for transactions within the Marketplace for a particular company. A valid session token is required for authentication. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER CompanyAccountId The unique account ID of the company for which the credit limit is being requested. This ID uniquely identifies the company in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $companyAccountId = 123456 $creditLimit = Get-MarketplaceCompanyCreditLimit -SessionToken $sessionToken -CompanyAccountId $companyAccountId This example retrieves the credit limit for the company with account ID 123456 using a session token obtained beforehand. .NOTES The credit limit is a financial control mechanism within the Marketplace. It determines the maximum amount a company can spend or transact within a given period. Knowing a company's credit limit helps manage and plan Marketplace transactions effectively. #> function Get-MarketplaceCompanyCreditLimit { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$CompanyId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getCreditLimitUrl = "$baseUrl/GetCreditLimit" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $CompanyId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getCreditLimitUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves a list of departments under a specified parent account from the Marketplace API. .DESCRIPTION The Get-MarketplaceDepartments function lists all departments associated with a given parent account within the Marketplace. This function is ideal for administrators or partners who need to manage or review the departments within their organization. It requires a valid session token to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, which is used to authenticate the request. This token represents the authenticated session of the user. .PARAMETER ParentAccountId The account ID of the parent account for which the list of departments is being requested. This ID uniquely identifies the parent account in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $parentAccountId = 78910 $departments = Get-MarketplaceDepartments -SessionToken $sessionToken -ParentAccountId $parentAccountId This example fetches a list of all departments under the parent account with ID 78910, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceDepartments -SessionToken "yourSessionTokenHere" -ParentAccountId 12345 Directly uses a session token to retrieve all departments associated with the parent account ID 12345. This method is convenient when the session token and parent account ID are already known or stored. .NOTES The returned list includes basic information about each department, such as the department name, account ID, and any specific department details. This function complements other cmdlets designed for organizational management within the Marketplace, enabling effective oversight and management of departments. #> function Get-MarketplaceDepartments { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$ParentAccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getDepartmentsUrl = "$baseUrl/GetDepartments" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ parentAccountId = $ParentAccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getDepartmentsUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves details of a specific company from the Marketplace API. .DESCRIPTION The Get-MarketplaceCompany function fetches detailed information about a specific company within the Marketplace, using its unique company account ID. This function is useful for administrators who need to view or manage company information. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER CompanyAccountId The unique account ID of the company for which details are being requested. This ID uniquely identifies the company in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $companyAccountId = 123456 $companyDetails = Get-MarketplaceCompany -SessionToken $sessionToken -CompanyAccountId $companyAccountId This example retrieves the details of the company with account ID 123456, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceCompany -SessionToken "yourSessionTokenHere" -CompanyAccountId 654321 Directly uses a session token to fetch details of the company with account ID 654321. This method is useful when you already have the session token and the company account ID ready. .NOTES Ensure the company account ID corresponds to an existing company in the Marketplace. If the provided ID does not match any company, or if the session token is invalid or expired, the request will fail. This function enables comprehensive management of company profiles within the Marketplace. #> function Get-MarketplaceCompany { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$AccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getCompanyUrl = "$baseUrl/GetCompany" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $AccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getCompanyUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves details of a company from the Marketplace API using the VAT ID. .DESCRIPTION The Get-MarketplaceCompanyByVatId function fetches detailed information about a company registered in the Marketplace, using the company's VAT ID as an identifier. This function is useful for users who need to retrieve company details without knowing the specific Marketplace account ID but have the VAT ID. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER VatId The VAT ID of the company for which details are being requested. This VAT ID is a unique identifier for companies within the European Union and some other regions. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $vatId = "GB999999973" $companyDetails = Get-MarketplaceCompanyByVatId -SessionToken $sessionToken -VatId $vatId This example retrieves the details of the company with the specified VAT ID, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceCompanyByVatId -SessionToken "yourSessionTokenHere" -VatId "GB999999973" Directly uses a session token to fetch details of the company with the given VAT ID. This method is useful when you have the session token and the VAT ID readily available. .NOTES This function allows for efficient retrieval of company details based on VAT ID, which can be particularly useful in scenarios where direct account identification is not feasible. Ensure that the VAT ID is correctly formatted and valid within the Marketplace's operational region to avoid errors in the retrieval process. #> function Get-MarketplaceCompanyByVatId { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [string]$VatId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getCompanyByVatIdUrl = "$baseUrl/GetCompanyByVatId" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ vatId = $VatId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getCompanyByVatIdUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Sets the credit limit for a specific company in the Marketplace API. .DESCRIPTION The Set-MarketplaceCompanyCreditLimit function updates the credit limit for a specified company within the Marketplace. This function allows administrators to adjust the financial thresholds for companies, controlling their purchasing capacity within the Marketplace environment. It requires a valid session token, the company's unique ID, the new credit limit value, and an optional comment explaining the reason for the credit limit change. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER CompanyId The unique ID of the company for which the credit limit is being set. This ID uniquely identifies the company within the Marketplace. .PARAMETER CreditLimit The new credit limit to be set for the company. This value determines the maximum amount the company can spend within the Marketplace. .PARAMETER Comment An optional comment explaining the reason for the credit limit change. This can be useful for audit trails or administrative records. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken Set-MarketplaceCompanyCreditLimit -SessionToken $sessionToken -CompanyId 123456 -CreditLimit 10000 -Comment "Increased due to good payment history" This example sets the credit limit for the company with ID 123456 to 10,000, with a comment noting the reason for the increase. .EXAMPLE Set-MarketplaceCompanyCreditLimit -SessionToken "yourSessionTokenHere" -CompanyId 654321 -CreditLimit 5000 Directly uses a session token to set the credit limit for the company with ID 654321 to 5,000, without providing a comment. .NOTES Changing a company's credit limit should be done with consideration of the company's financial standing and purchasing history within the Marketplace. It's recommended to document reasons for significant adjustments to credit limits for future reference and compliance purposes. #> function Set-MarketplaceCompanyCreditLimit { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$CompanyId, [Parameter(Mandatory = $true)] [decimal]$CreditLimit, [Parameter(Mandatory = $false)] [string]$Comment ) $baseUrl = $env:MARKETPLACE_BASE_URL $setCreditLimitUrl = "$baseUrl/SetCreditLimit" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $CompanyId limit = $CreditLimit comment = $Comment } | ConvertTo-Json $response = Invoke-RestMethod -Uri $setCreditLimitUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Updates details of an existing company in the Marketplace API. .DESCRIPTION The Update-MarketplaceCompany function allows for updating the information of an existing company within the Marketplace. This could include changes to the company's name, address, contact information, and more. A valid session token is required to authenticate and authorize the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER UpdatedCompanyDetails A hashtable containing the company details to be updated. This includes any field that the Marketplace API allows to be updated such as company name, VAT ID, email, address, and other relevant details. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $updatedCompanyDetails = @{ "CompanyId" = 123456 "CompanyName" = "New Company Name Ltd." "Email" = "newemail@examplecompany.com" "Address" = "123 New Address Street" "City" = "New City" } Update-MarketplaceCompany -SessionToken $sessionToken -UpdatedCompanyDetails $updatedCompanyDetails This example updates the details of the company with the specified changes, using a session token obtained beforehand. .EXAMPLE Update-MarketplaceCompany -SessionToken "yourSessionTokenHere" -UpdatedCompanyDetails @{ "CompanyId" = 654321 "VATID" = "GB999999973" "Country" = "Example Country" } Directly uses a session token to update specific details of the company with ID 654321. This method is useful when you have the session token and know exactly which details need to be updated. .NOTES Ensure that the keys in the UpdatedCompanyDetails hashtable match the field names expected by the Marketplace API. Incorrect field names or unsupported fields may lead to errors. It's recommended to first retrieve the current company details using Get-MarketplaceCompany or similar functions to understand which fields are available for updates. #> function Update-MarketplaceCompany { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [hashtable]$UpdatedCompanyDetails ) $baseUrl = $env:MARKETPLACE_BASE_URL $updateCompanyUrl = "$baseUrl/UpdateCompany" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = $UpdatedCompanyDetails | ConvertTo-Json $response = Invoke-RestMethod -Uri $updateCompanyUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Creates a new user within the Marketplace platform. .DESCRIPTION The New-MarketplaceUser function allows administrators to create a new user profile in the Marketplace. This function is useful for adding new members to a company's Marketplace account, granting them access to the platform. A valid session token is required to authenticate and authorize the creation request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER UserDetails A hashtable containing the details of the user to be created. The hashtable should include key-value pairs for necessary user information such as name, email, role, and other relevant details as required by the Marketplace API. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $userDetails = @{ "Email" = "newuser@example.com" "FirstName" = "New" "LastName" = "User" "Role" = "User" } New-MarketplaceUser -SessionToken $sessionToken -UserDetails $userDetails This example creates a new user with the provided details, using a session token obtained beforehand. .EXAMPLE $sessionToken = "yourSessionTokenHere" $userDetails = @{ "Email" = "anotheruser@example.com" "FirstName" = "Another" "LastName" = "User" "Role" = "Administrator" } New-MarketplaceUser -SessionToken $sessionToken -UserDetails $userDetails Uses a session token directly to create another user with administrator privileges. This method is useful when you already have the session token and need to quickly add a new administrator to your Marketplace account. .NOTES Ensure that all required fields are included in the UserDetails hashtable to avoid errors during the user creation process. It's also important to assign appropriate roles to new users according to their responsibilities and access needs within the Marketplace. This function enhances the ability to manage user access and roles within the Marketplace environment effectively. #> function New-MarketplaceUser { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [hashtable]$UserDetails ) $baseUrl = $env:MARKETPLACE_BASE_URL $createUserUrl = "$baseUrl/CreateUser" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = $UserDetails | ConvertTo-Json $response = Invoke-RestMethod -Uri $createUserUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves details of a specific user from the Marketplace API. .DESCRIPTION The Get-MarketplaceUser function fetches detailed information about a specific user within the Marketplace by using their unique account ID. This function is useful for administrators who need to view or manage individual user profiles within their Marketplace account. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER AccountId The unique account ID of the user for which details are being requested. This ID uniquely identifies the user in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $accountId = 123456 $userDetails = Get-MarketplaceUser -SessionToken $sessionToken -AccountId $accountId This example retrieves the details of the user with account ID 123456, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceUser -SessionToken "yourSessionTokenHere" -AccountId 654321 Directly uses a session token to fetch details of the user with account ID 654321. This method is useful when you already have the session token and the user account ID ready. .NOTES Ensure the account ID corresponds to an existing user in the Marketplace. If the provided ID does not match any user, or if the session token is invalid or expired, the request will fail. This function enables comprehensive management of user profiles within the Marketplace, including reviewing user roles, access rights, and personal details. #> function Get-MarketplaceUser { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$AccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getUserUrl = "$baseUrl/GetUser" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ accountId = $AccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getUserUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Retrieves a list of all users under a specified parent account from the Marketplace API. .DESCRIPTION The Get-MarketplaceUsers function lists all users associated with a given parent account within the Marketplace. This function is useful for administrators who need to manage or review user accounts under their control. A valid session token is required to authenticate the request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER ParentAccountId The account ID of the parent account for which the list of users is being requested. This ID uniquely identifies the parent account in the Marketplace. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $parentAccountId = 78910 $users = Get-MarketplaceUsers -SessionToken $sessionToken -ParentAccountId $parentAccountId This example fetches a list of all users under the parent account with ID 78910, using a session token obtained beforehand. .EXAMPLE Get-MarketplaceUsers -SessionToken "yourSessionTokenHere" -ParentAccountId 12345 Directly uses a session token to retrieve all users associated with the parent account ID 12345. This method is convenient when the session token and parent account ID are already known or stored. .NOTES The returned list includes basic information about each user, such as name, email, and role within the Marketplace. This function complements other cmdlets designed for user management within the Marketplace, enabling effective oversight and management of user access and roles. #> function Get-MarketplaceUsers { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [int]$ParentAccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $getUsersUrl = "$baseUrl/GetUsers" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = @{ parentAccountId = $ParentAccountId } | ConvertTo-Json $response = Invoke-RestMethod -Uri $getUsersUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } <# .SYNOPSIS Updates details of an existing user in the Marketplace API. .DESCRIPTION The Set-MarketplaceUser function allows for updating the information of an existing user within the Marketplace. This can include changes to the user's name, email, role, and other relevant details. A valid session token is required to authenticate and authorize the update request. .PARAMETER SessionToken The session token obtained from the Marketplace API, used to authenticate the request. .PARAMETER UserDetails A hashtable containing the user details to be updated. Each key-value pair in the hashtable represents a field to update and its new value. Note that the user's AccountId must also be provided either as part of the hashtable or separately. .PARAMETER AccountId The unique account ID of the user to be updated. This ID uniquely identifies the user within the Marketplace. If not included in the UserDetails hashtable, it must be provided separately. .EXAMPLE $sessionToken = Get-MarketplaceSessionToken $userDetails = @{ "Email" = "updateduser@example.com" "FirstName" = "Updated" "LastName" = "User" } $accountId = 123456 Set-MarketplaceUser -SessionToken $sessionToken -UserDetails $userDetails -AccountId $accountId This example updates the user with account ID 123456, changing their email and name to the specified values, using a session token obtained beforehand. .EXAMPLE Set-MarketplaceUser -SessionToken "yourSessionTokenHere" -UserDetails @{ "AccountId" = 654321 "Role" = "Administrator" } Uses a session token directly to update the role of the user with account ID 654321 to "Administrator". This method is useful when you have the session token and know exactly which user details need to be updated. .NOTES Ensure that the keys in the UserDetails hashtable match the field names expected by the Marketplace API. Incorrect field names or unsupported fields may lead to errors. Before attempting to update a user, consider retrieving their current details using Get-MarketplaceUser to understand which fields are available for updates. #> function Set-MarketplaceUser { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [string]$SessionToken, [Parameter(Mandatory = $true)] [hashtable]$UserDetails, [Parameter(Mandatory = $true)] [int]$AccountId ) $baseUrl = $env:MARKETPLACE_BASE_URL $updateUserUrl = "$baseUrl/UpdateUser" $headers = @{ "Authenticate" = "CCPSessionId $SessionToken" } $body = $UserDetails | Add-Member -Type NoteProperty -Name "AccountId" -Value $AccountId -PassThru | ConvertTo-Json $response = Invoke-RestMethod -Uri $updateUserUrl -Method Post -ContentType "application/json; charset=UTF-8" -Headers $headers -Body $body return $response } Export-ModuleMember -Function Set-MarketplaceAPIEnvironmentVariables, New-MarketplaceUser, Get-MarketplaceUser, Get-MarketplaceUsers, Set-MarketplaceUser, Get-MarketplaceDepartments, Get-MarketplaceCompany, Get-MarketplaceCompanyByVatId, Set-MarketplaceCompanyCreditLimit, Update-MarketplaceCompany, New-MarketplaceCompany, Get-MarketplaceCompanies, Get-MarketplaceCompanyCreditLimit, Get-MarketplaceSessionToken, Get-MarketplaceLatestInvoices, Get-MarketplaceLatestInvoicesForPeriod, Get-MarketplacePreviewInvoices, Get-MarketplaceReports, Invoke-MarketplaceExecuteReport, New-MarketplaceSubscription, Set-MarketplaceSubscription, Get-MarketplaceSubscription, Get-MarketplaceSubscriptions, Get-MarketplaceSubscriptionWithAddons |