以異步方式更新客戶的資格條件

使用非同步方式更新客戶的資格。

合作夥伴可以異步更新客戶的資格,將其更改為「教育」、「政府社區雲」或「國有企業」。 無法設定其他值,例如 「None」 和 「Nonprofit」。

先決條件

  • 合作夥伴中心驗證中所述的憑證。 此案例僅支援使用 App+User 認證進行驗證。

  • 客戶標識碼 (customer-tenant-id)。 在 合作夥伴中心,如果您不知道客戶的標識碼,可以選取 [客戶] 工作區,然後從客戶清單中選取客戶,再選擇 帳戶來查閱客戶的標識碼。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找 Microsoft ID。 Microsoft識別碼與客戶標識碼 (customer-tenant-id) 相同。

  • 僅限政府社群雲端 (GCC) 資格:您至少需要下列其中一個細微的委派系統管理員許可權 (GDAP) 角色。 若要深入瞭解 GDAP,請探索我們的 MS Learn 文章,從 GDAP 簡介 開始

    • 目錄讀取器
    • 目錄撰寫器
    • 授權管理員
    • 使用者管理員

C#

若要建立客戶的「教育」資格,請先建立 CustomerQualificationRequest 類型物件,並指定 Education 資格類型和 EducationSegment,以及 Website(選擇性)。

然後,使用客戶標識符呼叫 IAggregatePartner.Customers.ById 方法。

然後使用 Qualification 屬性來取得 ICustomerQualification 介面。

最後,使用 CreateQualifications() 類型物件做為輸入參數,呼叫 CreateQualificationsAsync()CustomerQualificationRequest

// Education
var eduRequestBody = new CustomerQualificationRequest 
{
    Qualification = "Education",
    EducationSegment = "K12", // could also be "HigherEducation"
    Website = "example.edu"
};

var eduCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(eduRequestBody);

// State Owned Entity
var soeRequestBody = new CustomerQualificationRequest 
{
    Qualification = "StateOwnedEntity"
};

var soeCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(soeRequestBody);

範例主控台範例應用程式專案:SdkSamples 類別:CreateCustomerQualification.cs

若要將現有沒有資格的客戶的資格更新為 GovernmentCommunityCloud,合作夥伴也必須包含客戶的驗證碼。

首先,建立 CustomerQualificationRequest 類型物件,並指定 GovernmentCommunityCloud 資格類型和驗證碼。

然後,使用客戶標識符呼叫 IAggregatePartner.Customers.ById 方法。

然後使用 Qualification 屬性來取得 ICustomerQualification 介面。

最後,使用 CreateQualifications() 類型物件做為輸入參數,呼叫 CreateQualificationsAsync()CustomerQualificationRequest

var gccRequestBody = new CustomerQualificationRequest 
{
    Qualification = "GovernmentCommunityCloud",
    ValidationCode = "<validation code>"
};

var gccCustomerQualification = partnerOperations.Customers.ById(existingCustomer.Id).Qualification.CreateQualifications(gccRequestBody);

範例主控台範例應用程式項目:SdkSamples 類別: CreateCustomerQualificationWithGCC.cs

REST 要求

要求語法

方法 要求 URI
POST {baseURL}/v1/customers/{customer_tenant_id}/資格 HTTP/1.1

URI 參數

使用下列查詢參數來更新資格。

名字 類型 必填 描述
客戶承租者 ID GUID 是的 此值是以 GUID 格式化 customer-tenant-id,可讓轉銷商篩選屬於轉銷商之指定客戶的結果。

請求標頭

如需詳細資訊,請參閱 合作夥伴中心 REST 標頭

請求主體

下表描述請求主體中的資格物件。

財產 類型 必填 描述
資格 字串 是的 CustomerQualification 列舉中的字串值。

下表特別說明 教育資格 的請求主體。

財產 類型 必填 描述
資格 字串 是的 教育
教育區段 字串 是的 K12,高等教育
網站 字串 教育實體的網站

如果資格是 教育,則 教育區段 為必填欄位。

  • EducationSegment 的允許值為 K12HigherEducation
  • 網站仍然是選擇性欄位,只有當學歷與教育相關時才適用。 不過,如果有提供/適用,強烈建議將其納入其中。

下表專門說明 GovernmentCommunityCloud 資格 的請求主體。

財產 類型 必填 描述
資格 字串 是的 政府社群雲
驗證碼 字串 是的 合作夥伴的 GCC 驗證碼。 範例 - 123456

如果資格適用於 GovernmentCommunityCloud,則 ValidationCode 為必要欄位。

要求範例

POST https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/qualifications HTTP/1.1
Accept: application/json
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 037db222-6d8e-4d7f-ba78-df3dca33fb68

// SOE
{
    "qualification": "StateOwnedEntity"
}

// Education
{
    "qualification": "Education",
    "educationSegment": "HigherEducation", // could also be "K12"
    "website": "contoso.edu"
}

// GCC
{
    "qualification": "GovernmentCommunityCloud",
    "validationCode": "123456"
}

REST 回應

如果成功,這個方法會在響應主體中返回資格物件。 以下是對客戶進行的 POST 呼叫,其中先前資格為 ,並具有 教育 資格的範例。

回應成功和錯誤碼

每個回應都有一個 HTTP 狀態代碼,指出成功或失敗和其他偵錯資訊。 使用網路追蹤工具來讀取此程式代碼、錯誤類型和其他參數。 如需完整清單,請參閱 錯誤碼

回應範例

HTTP/1.1 201 CREATED
Content-Length: 29
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 037db222-6d8e-4d7f-ba78-df3dca33fb68
{
    "qualification": "Education",
    "vettingStatus": "InReview",
    "vettingCreateDate": "2020-12-04T20:54:24Z" // UTC
}