共用方式為


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

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

合作夥伴可以異步更新客戶的資格,成為「教育」、「GovernmentCommunityCloud」或「StateOwnedEntity」。 無法設定其他值,例如 「None」 和 「Nonprofit」。

必要條件

  • 認證,如合作夥伴中心驗證所述。 此案例僅支援使用「應用程式+使用者」認證來進行驗證。

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

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

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

C#

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

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

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

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

// 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 介面。

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

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 參數

使用下列查詢參數來更新限定性。

名稱 類型​​ 必要 描述
customer-tenant-id GUID Yes 此值是 GUID 格式的客戶 租使用者識別碼 ,可讓轉銷商篩選屬於轉銷商之指定客戶的結果。

要求標頭

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

要求本文

下表描述要求主體中的限定性物件。

屬性 型別 必要 描述
資格 字串 Yes CustomerQualification 列舉中的字串值。

下表特別說明教育資格的要求本文。

屬性 型別 必要 描述
資格 字串 Yes 教育版
EducationSegment 字串 Yes K12, HigherEducation
Website 字串 No 教育實體的網站

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

  • EducationSegment 的允許值為 K12HigherEducation
  • 網站仍然是選擇性欄位,只有在資格是教育版時才相關。 不過,如果強烈建議使用/適用,請將其納入其中

下表特別說明 GovernmentCommunityCloud 資格的要求本文。

屬性 型別 必要 描述
資格 字串 Yes GovernmentCommunityCloud
ValidationCode 字串 Yes 合作夥伴的 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: 7d2456fd-2d79-46d0-9f8e-5d7ecd5f8745
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: 7d2456fd-2d79-46d0-9f8e-5d7ecd5f8745
MS-RequestId: 037db222-6d8e-4d7f-ba78-df3dca33fb68
{
    "qualification": "Education",
    "vettingStatus": "InReview",
    "vettingCreateDate": "2020-12-04T20:54:24Z" // UTC
}