Share via


Update (PUT) a VMCheckPoint [SPFSDK][VMMREF]

 

Applies To: Windows Azure Pack

Updates a VMCheckPoint [SPFSDK][VMMREF] entity by using the HTTP PUT operation.

Here is a list of examples related to this collection operation.

  • Example: Restore a checkpoint by id

  • Example: Restore the last checkpoint of a virtual machine

Request

For more information about the placeholders used in the URI, see URL placeholders.

Method

Request URI

HTTP Version

PUT

https://{server-name}:{auth-port}/{subscription-id}/services/systemcenter/vmm/VMCheckPoints(ID=Guid'[value]',StampId=Guid'[value]')

HTTP/1.1

Request URI Parameters

URI Parameter

Description

ID

Required. [Edm.Guid] The identifier of the entity.

StampId

Required. [Edm.Guid] The identifier of the stamp that restricts the query.

Request Headers

This operation does not use any non-standard request headers.

For more information about the common request headers used by this operation, see Common HTTP request information

Request Body

The request body should contain a single (depending on the request headers) XML or JSON encoded VMCheckPoint [SPFSDK][VMMREF] entity that is to be updated. Here is the request body of a single entity.

{
  "odata.type": "VMM.VMCheckPoint",
  "Accessibility": "Public",
  "AddedTime": "2014-08-28T14:19:48.883-07:00",
  "CheckpointID": "d2d1e137-bd2e-45e5-a6af-63c3825f9052",
  "Confirm": null,
  "Description": "",
  "Enabled": true,
  "ID": "831e819f-f852-47a8-b4b0-c61ba062df73",
  "ModifiedTime": "2014-09-04T05:15:58.733-07:00",
  "Name": "Checkpoint 1",
  "ParentCheckpointID": "2694d261-16d3-4f9a-8e1c-9d2b4f63e99f",
  "RunAsynchronously": null,
  "StampId": "d70c1a9b-c241-48f5-880a-b6c36071e653",
  "VMCheckPointAction": "Restore",
  "VMId": "f11b61fa-b5c7-4807-93b4-f9b371896c6f"
}

Response

Response Codes

This operation does not return any non-standard OData response codes. If successful, it will return code 204 No Content.

Response Headers

This operation does not use any non-standard response headers.

For more information about the common response headers used by this operation, see Common HTTP response information.

Response Body

None

Example: Restore a checkpoint by id

This example gets a specific checkpoint by id and restores it.

For more information about how to get started with using the code examples provided in this programming guide, see Programming in Visual Studio with Service Provider Foundation Services.

Guid checkpointId = new Guid("831e819f-f852-47a8-b4b0-c61ba062df73");
Guid stampId = new Guid("d70c1a9b-c241-48f5-880a-b6c36071e653");

SpfVMM.VMCheckPoint checkpoint = vmmService.VMCheckPoints.Where(c => c.StampId == stampId && c.ID == checkpointId).First();
checkpoint.VMCheckPointAction = "Restore";

vmmService.UpdateObject(checkpoint);
vmmService.SaveChanges();

HTTP Request

MERGE https://contoso.com:30005/ae122d5f-3aab-4d75-ad48-d6593246a49e/services/systemcenter/vmm/VMCheckPoints(ID=guid'831e819f-f852-47a8-b4b0-c61ba062df73',StampId=guid'd70c1a9b-c241-48f5-880a-b6c36071e653') HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer {ENCODED AUTHENTICATION TOKEN}
x-ms-principal-id: tenant@fabrikam.com
Host: contoso.com:30005
Content-Length: 527
Expect: 100-continue

{"odata.type":"VMM.VMCheckPoint","Accessibility":"Public","AddedTime":"2014-08-28T14:19:48.883-07:00","CheckpointID":"d2d1e137-bd2e-45e5-a6af-63c3825f9052","Confirm":null,"Description":"","Enabled":true,"ID":"831e819f-f852-47a8-b4b0-c61ba062df73","ModifiedTime":"2014-09-04T05:15:58.733-07:00","Name":"Checkpoint 1","ParentCheckpointID":"2694d261-16d3-4f9a-8e1c-9d2b4f63e99f","RunAsynchronously":null,"StampId":"d70c1a9b-c241-48f5-880a-b6c36071e653","VMCheckPointAction":"Restore","VMId":"f11b61fa-b5c7-4807-93b4-f9b371896c6f"}

HTTP Response

HTTP/1.1 204 No Content
Cache-Control: no-cache
Content-Length: 0
Server: Microsoft-IIS/8.5
x-ms-request-id: b6bfdf79-e7f7-405e-94a4-7e0ae0dc80f5
X-Content-Type-Options: nosniff
request-id: d3df681c-b278-0000-90cc-e1d378b2cf01
DataServiceVersion: 1.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 04 Sep 2014 18:32:46 GMT

Example: Restore the last checkpoint of a virtual machine

This example gets all checkpoints for a specific virtual machine, orders them by AddedTime, and selects the first result. Then the checkpoint is restored.

For more information about how to get started with using the code examples provided in this programming guide, see Programming in Visual Studio with Service Provider Foundation Services.

Guid vmId = new Guid("38c9c3b9-9288-4d7a-82fa-501cd4eb9ecb");
Guid stampId = new Guid("d70c1a9b-c241-48f5-880a-b6c36071e653");

SpfVMM.VMCheckPoint checkpoint = vmmService.VMCheckPoints.Where(c => c.StampId == stampId && c.VMId == vmId).OrderByDescending(c => c.AddedTime).First();

checkpoint.VMCheckPointAction = "Restore";

vmmService.UpdateObject(checkpoint);
vmmService.SaveChanges();

HTTP Request

MERGE https://contoso.com:30005/ae122d5f-3aab-4d75-ad48-d6593246a49e/services/systemcenter/vmm/VMCheckPoints(ID=guid'f05bbc87-1219-4661-abcb-417bae006c15',StampId=guid'd70c1a9b-c241-48f5-880a-b6c36071e653') HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer {ENCODED AUTHENTICATION TOKEN}
x-ms-principal-id: tenant@fabrikam.com
Host: contoso.com:30005
Content-Length: 526
Expect: 100-continue

{"odata.type":"VMM.VMCheckPoint","Accessibility":"Public","AddedTime":"2014-09-04T11:21:43.497-07:00","CheckpointID":"143ff497-7de0-48b7-9f9a-b9082360c39f","Confirm":null,"Description":"","Enabled":true,"ID":"f05bbc87-1219-4661-abcb-417bae006c15","ModifiedTime":"2014-09-04T11:21:49.15-07:00","Name":"Checkpoint 2","ParentCheckpointID":"faaadc47-d592-4695-a8fb-87bf695bd03c","RunAsynchronously":null,"StampId":"d70c1a9b-c241-48f5-880a-b6c36071e653","VMCheckPointAction":"Restore","VMId":"38c9c3b9-9288-4d7a-82fa-501cd4eb9ecb"}

HTTP Response

HTTP/1.1 204 No Content
Cache-Control: no-cache
Content-Length: 0
Server: Microsoft-IIS/8.5
x-ms-request-id: f7233b8f-1e75-4cbf-8755-d7c61a2a8b08
X-Content-Type-Options: nosniff
request-id: d3df681c-b278-0000-2fcc-e1d378b2cf01
DataServiceVersion: 1.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 04 Sep 2014 18:23:31 GMT

See Also

VMCheckPoints Collection [SPFSDK][VMMREF]
VMCheckPoint [SPFSDK][VMMREF]