Skip to main content
Skip table of contents

API Guide for Price Management

Overview

This document explains how Cloudmore APIs can be used to automatically update global or customer-specific prices in response to these factors.

By integrating these APIs into your pricing workflow, you can ensure that pricing adjustments are timely and accurate, helping you maintain profitability and avoid unexpected margin erosion.

The document also highlights how automation supports scalable and responsive pricing strategies across services and customer segments.

Broker level price actions with API

This part is about managing global prices that apply to all customers under a Broker. You can use Cloudmore APIs to check current prices and update them when needed to adjust your pricing strategy. This helps you keep pricing consistent across all organizations and ensures your margins are protected.

Use Case

Use this when you want to set a standard price for all customers. For example:

  • You want to adjust prices across the board due to vendor cost changes.

  • You’re launching a new service and want consistent pricing for all organizations.

  • You need to update pricing regularly based on market trends or internal margin goals.

API Details

Operation

Swagger Description

Method

API

Returns product price

Returns all reseller products for a service

GET

/api/resellers/{resellerId}/services/{serviceId}/pricelist

Update Product and Addon Pricing

Updates product or addon prices for the broker.

PUT

/api/resellers/{resellerId}/services/{serviceId}/pricelist

For more information related to the API, refer to the Swagger Documentation with the collection ResellerPriceList.

Organization level price actions with API

This part focuses on customer-specific pricing. Sometimes, you may want to offer special prices to certain customers based on contracts, usage, or other business rules. Cloudmore APIs let you view and update prices for individual organizations. This gives you flexibility to tailor pricing while keeping everything accurate and automated.

Use Case

Use this when you need custom pricing for individual customers. For example:

  • A customer has a special contract or negotiated rate.

  • You want to offer discounts based on usage or loyalty.

  • You need to reflect pricing differences based on region or business type.

API Details

Operation

Swagger Description

Method

API

Returns product price

Returns all organization products for a service

GET

/api/resellers/{resellerId}/organizations/{organizationId}/services/{serviceId}/pricelist

Update Product and Addon Pricing

Updates the product or addon price for the organization

PUT

/api/resellers/{resellerId}/organizations/{organizationId}/services/{serviceId}/pricelist

For more information related to the API, refer to the Swagger Documentation with the collection OrganizationPriceList.

Examples to get Organization Prices

Powershell
POWERSHELL
# Define constants
RESELLER_ID = '11111111-2222-3333-4444-555555555555' # Replace with you Broker ID
CLIENT_ID = 'ro.customer.client'
API_SECRET = 'MySecret' # Replace with your API Secret
USERNAME = 'username@broker.com' # Replace with your username
PASSWORD = 'MyPassword' # Replace with your password
$BASE_NAME = 'https://api.cloudmore.com'
$BASE_URL = "$BASE_NAME/api"
$CSV_FILE = 'discrepancy_report.csv'
# Create a Base64 encoded header for auth
$Base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($CLIENT_ID):$($API_SECRET)"))
# Get the Bearer Token
$TokenBody = @{
    grant_type = 'password'
    username   = $USERNAME
    password   = $PASSWORD
    scope      = 'api'
}
$Token = Invoke-RestMethod -Uri "$BASE_NAME/connect/token" -Headers @{Authorization=("Basic {0}" -f $Base64AuthInfo)} -Method Post -Body $TokenBody
$headers = @{
    Accept        = 'application/json'
    Authorization = "Bearer $($Token.access_token)"
}
function Get-Organizations {
    Invoke-RestMethod -Uri "$BASE_URL/resellers/$RESELLER_ID/Organizations" -Headers $headers
}
function Get-OrganizationServices {
    param ($OrgID)
    Invoke-RestMethod -Uri "$BASE_URL/resellers/$RESELLER_ID/organizations/$OrgID/services" -Headers $headers
}
function Get-PricesPerService {
    param ($OrgID, $ServiceID)
    Invoke-RestMethod -Uri "$BASE_URL/resellers/$RESELLER_ID/organizations/$OrgID/services/$ServiceID/pricelist" -Headers $headers
}
# Extract data and write discrepancies to CSV
$organizations = Get-Organizations
$totalOrgs = $organizations.Count
$progressCounter = 0
$organizations | ForEach-Object {
    $org = $_
    $progressCounter++
    Write-Progress -PercentComplete (($progressCounter / $totalOrgs) * 100) -Status "Processing $($org.name)" -Activity "Gathering data"
    $services = Get-OrganizationServices -OrgID $org.id
    $services | ForEach-Object {
        $service = $_
        $prices = Get-PricesPerService -OrgID $org.id -ServiceID $service.id
        $prices | Where-Object { $_.salesPrice -ne $_.recommendedPrice } | ForEach-Object {
            $data = [PSCustomObject]@{
                'Org Name'         = $org.name
                'Service'          = $service.name
                'ProductName'      = $_.name
                'ItemCode'         = $_.itemCode
                'RecommendedPrice' = $_.recommendedPrice
                'SalesPrice'       = $_.salesPrice
                'Margin'           = $_.margin
            }
            $data | Export-Csv -Path $CSV_FILE -NoTypeInformation -Append
        }
    }
}
Write-Output "Processing complete."
Python
PY
import requests
import base64
import json
import csv
# Define constants
RESELLER_ID = '11111111-2222-3333-4444-555555555555' # Replace with you Broker ID
CLIENT_ID = 'ro.customer.client'
API_SECRET = 'MySecret' # Replace with your API Secret
USERNAME = 'username@broker.com' # Replace with your username
PASSWORD = 'MyPassword' # Replace with your password
BASE_URL = 'https://api.cloudmore.com/api'
CSV_FILE = 'discrepancy_report.csv'
# Base64 encode the API secret
client_decoded = f'{CLIENT_ID}:{API_SECRET}'
b64_secret = base64.b64encode(client_decoded.encode()).decode()
# Get Access Token using username and password
token_url = 'https://api.cloudmore.com/connect/token'
token_headers = {'Authorization': f'Basic {b64_secret}'}
token_data = {
    'grant_type': 'password',
    'username': USERNAME,
    'password': PASSWORD,
    'scope': 'api'
}
token_response = requests.post(token_url, headers=token_headers, data=token_data)
token = token_response.json().get("access_token")
print('Access Token received:', token)
HEADERS = {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {token}' # token fetched from previous steps
}
# Fetch all organizations
def get_organizations():
    url = f"{BASE_URL}/resellers/{RESELLER_ID}/Organizations"
    response = requests.get(url, headers=HEADERS)
    return response.json()
# Fetch organization services
def get_organization_services(org_id):
    url = f"{BASE_URL}/resellers/{RESELLER_ID}/organizations/{org_id}/services"
    response = requests.get(url, headers=HEADERS)
    return response.json()
# Fetch prices per service
def get_prices_per_service(org_id, service_id):
    url = f"{BASE_URL}/resellers/{RESELLER_ID}/organizations/{org_id}/services/{service_id}/pricelist"
    response = requests.get(url, headers=HEADERS)
    return response.json()
def main():
    organizations = get_organizations()
    total_organizations = len(organizations)
    
    # Open the CSV file for writing
    with open(CSV_FILE, mode='w', newline='') as file:
        writer = csv.writer(file)
        # Write the header
        writer.writerow(['Org Name', 'Service', 'ProductName', 'ItemCode', 'RecommendedPrice', 'SalesPrice', 'Margin'])
        
        for index, org in enumerate(organizations, start=1):
            print(f"Processing organization {index}/{total_organizations}: {org['name']}...")
            services = get_organization_services(org["id"])
            for service in services:
                prices = get_prices_per_service(org["id"], service["id"])
                for price in prices:
                    if price["salesPrice"] != price["recommendedPrice"]:
                        # Write to CSV
                        writer.writerow([
                            org['name'],
                            service['name'],
                            price['name'],
                            price['itemCode'],
                            price['recommendedPrice'],
                            price['salesPrice'],
                            price['margin']
                        ])
        print(f"Finished processing organization {index}/{total_organizations}: {org['name']}.\n")
    print("Processing complete.")
if __name__ == '__main__':
    main()

Subscription level price actions with API

Microsoft 365 CSP Direct, seat based

This part is about managing subscription-level prices for seat-based Microsoft 365 offers under CSP Direct. Using the APIs, you can view current pricing, apply promotions, and update subscription prices to match your pricing strategy.

API Details

Operation

Swagger Description

Method

API

Returns all organizations NCE Subscriptions

Returns all organization's new commerce subscriptions

GET

api/resellers/{resellerId}/organizations/{organizationId}/services/csp/nce/subscriptions

Return the NCE subscription details of an organization

Returns organization new commerce subscription details

GET

/api/resellers/{resellerId}/organizations/{organizationId}/services/csp/nce/subscriptions/{id}

Update NCE Subscription

Updates Microsoft O365 CSP service new commerce subscription

PUT

/api/resellers/{resellerId}/organizations/{organizationId}/services/csp/nce/subscriptions/{subscriptionId}

For more information related to the API, refer to the Swagger Documentation with the collection OrganizationCspSubscriptionsNce.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.