Mettre à jour un SelfServePolicyUpdate a SelfServePolicy
S’applique à :Applies to:
- Espace partenairesPartner Center
Cette rubrique explique comment mettre à jour une stratégie libre-service.This topic explains how to update a self-serve policy.
PrérequisPrerequisites
- Informations d’identification, comme décrit dans Authentification auprès de l’Espace partenaires.Credentials as described in Partner Center authentication. Ce scénario prend en charge l’authentification avec les informations d’identification de l’application et de l’utilisateur.This scenario supports authentication with Application+User credentials.
C#C#
Pour supprimer une stratégie libre-service :To delete a self-serve policy:
Appelez la méthode collection iaggregatepartner. SelfServePolicies. méthode BYID avec l’identificateur d’entité pour récupérer une interface pour les opérations sur les stratégies.Call the IAggregatePartner.SelfServePolicies.ById method with the entity identifier to retrieve an interface to operations on the policies.
Appelez la méthode put ou PutAsync pour mettre à jour la stratégie libre-service.Call the Put or PutAsync method to update the self-serve policy.
// IAggregatePartner partnerOperations;
SelfServePolicy policy;
// All the operations executed on this partner operation instance will share the same correlation identifier but will differ in request identifier
IPartner scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Instance.Create(Guid.NewGuid()));
// updates the self-serve policies
partnerOperations.SelfServePolicies.ById(policy.id).Put(policy);
Demande RESTREST request
Syntaxe de la requêteRequest syntax
MéthodeMethod | URI de demandeRequest URI |
---|---|
PUTPUT | {baseURL}/v1/SelfServePolicy http/1.1{baseURL}/v1/SelfServePolicy HTTP/1.1 |
En-têtes de requêteRequest headers
- Un identificateur de demande et un identificateur de corrélation sont requis.A request identifier and correlation identifier are required.
- Pour plus d’informations, consultez en-têtes REST de l’espace partenaires .See Partner Center REST headers for more information.
Corps de la demandeRequest body
Ce tableau décrit les propriétés requises dans le corps de la demande.This table describes the required properties in the request body.
NomName | TypeType | DescriptionDescription |
---|---|---|
SelfServePolicySelfServePolicy | objectobject | Informations sur la stratégie libre-service.The self-serve policy information. |
SelfServePolicySelfServePolicy
Ce tableau décrit les champs obligatoires minimaux de la ressource SelfServePolicy nécessaire à la création d’une nouvelle stratégie libre-service.This table describes the minimum required fields from the SelfServePolicy resource needed to create a new self-serve policy.
PropriétéProperty | TypeType | DescriptionDescription |
---|---|---|
idid | stringstring | Identificateur de stratégie libre-service fourni lors de la création réussie de la stratégie libre-service.A self-serve policy identifier that is supplied upon successful creation of the self-serve policy. |
SelfServeEntitySelfServeEntity | SelfServeEntitySelfServeEntity | Entité libre-service à laquelle l’accès est accordé.The self-serve entity that is being granted access. |
Fournisseur d'autorisationsGrantor | Fournisseur d'autorisationsGrantor | Fournisseur d’autorisations qui accorde l’accès.The grantor that is granting access. |
AutorisationsPermissions | Tableau d’autorisationsArray of Permission | Tableau de ressources d' autorisation .An Array of Permission resources. |
EtagEtag | stringstring | ETag.The Etag. |
Exemple de requêteRequest example
PUT https://api.partnercenter.microsoft.com/v1/SelfServePolicy HTTP/1.1
Authorization: Bearer <token>
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Connection: Keep-Alive
{
"id": "634f6379-ad54-449b-9821-564f737158ab_0431a72c-7d8a-4393-b25e-ef63f5efb415",
"selfServeEntity": {
"selfServeEntityType": "customer",
"tenantID": "0431a72c-7d8a-4393-b25e-ef63f5efb415"
},
"grantor": {
"grantorType": "billToPartner",
"tenantID": "634f6379-ad54-449b-9821-564f737158ab"
},
"permissions": [{
"resource": "AzureReservedInstances",
"action": "Purchase"
}],
"attributes": {
"etag": "\"933523d1-3f63-4fc3-8789-5e21c02cdaed\"",
"objectType": "SelfServePolicy"
}
}
Réponse RESTREST response
En cas de réussite, cette API retourne une ressource SelfServePolicy pour la stratégie libre-service mise à jour.If successful, this API returns a SelfServePolicy resource for the updated self-serve policy.
Codes d’erreur et de réussite de la réponseResponse success and error codes
Chaque réponse est accompagnée d’un code d’état HTTP qui indique la réussite ou l’échec ainsi que des informations de débogage supplémentaires.Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Utilisez un outil de trace réseau pour lire ce code, le type d’erreur et des paramètres supplémentaires.Use a network trace tool to read this code, error type, and additional parameters. Pour obtenir la liste complète, consultez Codes d’erreur REST de l’Espace partenaires.For the full list, see Partner Center REST error codes.
Cette méthode retourne les codes d’erreur suivants :This method returns the following error codes:
Code d’état HTTPHTTP Status Code | Code d'erreurError code | DescriptionDescription |
---|---|---|
404404 | 600039600039 | La stratégie libre-service est introuvableSelf-serve policy was not found |
404404 | 600040600040 | L’identificateur de stratégie libre-service est incorrectSelf-serve policy identifier is incorrect |
Exemple de réponseResponse example
HTTP/1.1 200 Ok
Content-Length: 834
Content-Type: application/json; charset=utf-8
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
Date: Tue, 14 Feb 2017 20:06:02 GMT
{
"id": "634f6379-ad54-449b-9821-564f737158ab_0431a72c-7d8a-4393-b25e-ef63f5efb415",
"selfServeEntity": {
"selfServeEntityType": "customer",
"tenantID": "0431a72c-7d8a-4393-b25e-ef63f5efb415"
},
"grantor": {
"grantorType": "billToPartner",
"tenantID": "634f6379-ad54-449b-9821-564f737158ab"
},
"permissions": [{
"resource": "AzureReservedInstances",
"action": "Purchase"
}],
"attributes": {
"etag": "\"1ec98034-a249-46f4-b9dd-9cd464fb5e47\"",
"objectType": "SelfServePolicy"
}
}