Verify a partner PartnerID via C# or the Partner Center REST API
Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
How to verify a PartnerID.
The technique shown here verifies the PartnerID by requesting the partner's Microsoft AI Cloud Partner Program profile from Partner Center. The identifier is considered valid if the request succeeds.
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports authentication with App+User credentials only.
The partner PartnerID to verify. If you omit this value, the request retrieves the Microsoft AI Cloud Partner Program profile of the signed-in partner.
C#
To verify a partner's PartnerID, first retrieve an interface to partner profile collection operations from the IAggregatePartner.Profiles property. Then get an interface to Microsoft AI Cloud Partner Program profile operations from the MpnProfile property. Finally, call the Get or GetAsync methods with the PartnerID to retrieve the Microsoft AI Cloud Partner Program profile. If you omit the PartnerID from the Get or GetAsync call, the request attempts to retrieve the Microsoft AI Cloud Partner Program profile of the signed-in partner.
// IAggregatePartner partnerOperations;
// string partnerMpnId;
var partnerProfile = partnerOperations.Profiles.MpnProfile.Get(partnerMpnId);
Sample: Console test app. Project: Partner Center SDK Samples Class: VerifyPartnerMpnId.cs
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/profiles/mpn?mpnId={mpn-id} HTTP/1.1 |
URI parameter
Provide the following query parameter to identify the partner. If you omit this query parameter, the request returns the Microsoft AI Cloud Partner Program profile of the signed-in partner.
Name | Type | Required | Description |
---|---|---|---|
mpn-id | int | No | A PartnerID that identifies the partner. |
Request headers
For more information, see Partner Center REST headers.
Request body
None.
Request example
GET https://api.partnercenter.microsoft.com/v1/profiles/mpn?mpnId=9999999 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 560df6b9-6e53-4954-aed7-133477ac1194
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
MS-PartnerCenter-Client: Partner Center .NET SDK
Host: api.partnercenter.microsoft.com
Connection: Keep-Alive
Important
As of June 2023, the latest Partner Center .NET SDK release 3.4.0 is now archived. You can download the SDK release from GitHub, along with a readme file that contains useful information.
Partners are encouraged to continue to use the Partner Center REST APIs.
REST response
If successful, the response body contains the MpnProfile resource for the partner.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center REST error codes.
Response example (success)
HTTP/1.1 200 OK
Content-Length: 159
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: e39e0ddf-3fd0-4b7e-bb4e-8aebe242d3ee
MS-CV: s2GvkNgZsUSadxQX.0
MS-ServerId: 030011719
Date: Thu, 13 Apr 2017 18:13:40 GMT
{
"partnerName": "Microsoft Partner",
"mpnId": "4391507",
"profileType": "MpnProfile",
"links": {
"self": {
"uri": "/profiles/mpn",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "MpnProfile"
}
}
Response example (failure)
HTTP/1.1 404 Not Found
Content-Length: 124
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 560df6b9-6e53-4954-aed7-133477ac1194
MS-CV: sLRFZMWm+EKuL47u.0
MS-ServerId: 102030524
Date: Thu, 13 Apr 2017 18:26:51 GMT
{
"code": 3000,
"description": "Partner Organization with partner_id 9999999 could not be found",
"data": [],
"source": "PartnerFD"
}