依照識別碼取得服務要求詳細資料
適用於:合作夥伴中心 |美國政府適用的 Microsoft Cloud 合作夥伴中心
如何使用服務要求標識符擷取現有客戶服務要求的詳細數據。
必要條件
認證,如合作夥伴中心驗證所述。 此案例僅支援使用「應用程式+使用者」認證來進行驗證。
服務要求標識碼。
C#
若要擷取現有客戶服務要求的詳細數據,請呼叫 IServiceRequestCollection.ById 方法,並傳入 ServiceRequest.Id,以識別並傳回特定 ServiceRequest 物件的介面。
// IAggregatePartner partnerOperations;
// ServiceRequest existingServiceRequest as ServiceRequest;
ServiceRequest serviceRequestDetails = partnerOperations.ServiceRequests.ById(existingServiceRequest.Id).Get();
Console.WriteLine(string.Format("The primary contact for the service request {0} is {1} {2}.",
serviceRequestDetails.Title,
serviceRequestDetails.PrimaryContact.FirstName,
serviceRequestDetails.PrimaryContact.LastName,
));
REST 要求
要求語法
方法 | 要求 URI |
---|---|
GET | {baseURL}/v1/servicerequests/{servicerequest-id} HTTP/1.1 |
URI 參數
使用下列 URI 參數來取得指定的服務要求。
名稱 | 類型 | 必要 | 描述 |
---|---|---|---|
servicerequest-id | string | Y | 識別服務要求的英數位元值。 |
要求標頭
名稱 | 類型 | 必要 | 描述 |
---|---|---|---|
IncludeOrganizationRequests | string | 否 | 標頭,當存在時,會先授權使用者取得支援要求 管理員 角色,然後再嘗試取得服務要求詳細數據。 |
如需詳細資訊,請參閱合作夥伴中心 REST 標頭。
要求本文
無
要求範例
GET https://api.partnercenter.microsoft.com/v1/servicerequests/616122292874576 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: f9a030bd-e492-4c1a-9c70-021f18234981
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 0
REST 回應
如果成功,這個方法會在回應本文中傳 回服務要求 資源。
回應成功和錯誤碼
每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱 合作夥伴中心 REST 錯誤碼。
回應範例
HTTP/1.1 200 OK
Content-Length: 566
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: f9a030bd-e492-4c1a-9c70-021f18234981
MS-CV: rjLONPum/Uq94UQA.0
MS-ServerId: 030011719
Date: Mon, 09 Jan 2017 23:31:15 GMT
{
"title": "TrialSR",
"description": "Ignore this SR",
"severity": "critical",
"supportTopicId": "32444671",
"supportTopicName": "Cannot manage my profile",
"id": "616122292874576",
"status": "open",
"organization": {
"id": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
"name": "TEST_TEST_BugBash1"
},
"productId": "15960",
"createdDate": "2016-12-22T20:31:17.24Z",
"lastModifiedDate": "2017-01-09T23:31:15.373Z",
"lastClosedDate": "0001-01-01T00:00:00",
"notes": [{
"createdByName": "Account",
"createdDate": "2017-01-09T23:31:15.373",
"text": "Sample Note"
}
],
"attributes": {
"objectType": "ServiceRequest"
}
}