Deli z drugimi prek


Get a customer's usage spending budget

Applies to: Partner Center | Partner Center for Microsoft Cloud for US Government

You can update the spending budget (the SpendingBudget object) in the customer usage summary (the CustomerUsageSummary resource).

Prerequisites

  • Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.

  • A customer ID (customer-tenant-id). If you don't know the customer's ID, you can look it up in Partner Center by selecting the Customers workspace, then the customer from the customer list, then Account. On the customer’s Account page, look for the Microsoft ID in the Customer Account Info section. The Microsoft ID is the same as the customer ID (customer-tenant-id).

C#

To update a customer's usage spending budget:

  1. Create a new SpendingBudget object with the updated amount.

  2. Use the IAggregatePartner.Customers collection to call the ById() method with the specified customer's identifier.

  3. Call the Get or GetAsync method to get the customer's usage budget.

// IAggregatePartner partnerOperations;
// string selectedCustomerId;

// Create a new spending budget with the udpated amount.
var newUsageBudget = new SpendingBudget()
{
    Amount = 100
};

// Update the customer's usage budget.
var usageBudget = partnerOperations.Customers.ById(selectedCustomerId).UsageBudget.Get();

REST request

Request syntax

Method Request URI
GET {baseURL}/v1/customers/{customer-tenant-id}/usagebudget HTTP/1.1

URI parameter

Use the following query parameter to update the billing profile.

Name Type Required Description
customer-tenant-id guid Y The value is a GUID formatted customer-tenant-id that allows the reseller to filter the results for a given customer that belongs to the reseller.

Request headers

For more information, see Partner Center REST headers.

Request body

The full resource.

Request example

GET https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/usagebudget HTTP/1.1
Authorization: Bearer <token>
Accept: application/json, text/plain, */*
MS-RequestId: 312b044d-dc41-4b37-c2d5-7d27322d9654
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Content-Type: application/json;charset=utf-8
X-Locale: "en-US"

REST response

If successful, this method returns a user's spending budget with the updated amount.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and other debugging information. Use a network trace tool to read this code, error type, and other parameters. For the full list, see Error Codes.

Response example

HTTP/1.1 200 OK
Content-Length: 12014
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: be82a8ba-4a53-49f7-8313-b033c058687e
Date: Tue, 17 Sep 2019 20:31:45 GMT

{
    "amount": 100,
    "usageSpendingBudget": 100,
    "attributes": {
        "objectType": "SpendingBudget"
    },
    "links": {
        "self": {
            "uri": "/v1/customers/<customer-tenant-id>/usagebudget",
            "method": "GET",
            "headers": []
        }
    }
}