Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Azure

Performing storage account operations using REST (part 2) - Deleting tables using the REST API & WCF Data Services and AtomPub

3/13/2011 4:51:15 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

2. Deleting tables using the REST API

To delete a table using the StorageClient library, you need to call the DeleteTable method of your CloudTableClient object, passing in the name of the table that you wish to delete. The following code would delete the Products table:

var storageAccount =
CloudStorageAccount.Parse(
ConfigurationManager.AppSettings["DataConnectionString"]);

CloudTableClient tableClient =
storageAccount.CreateCloudTableClient();

tableClient.DeleteTable("Products");

If you wanted to delete the same table using the REST API directly, you could perform an HTTP DELETE (rather than a GET) request using the following URI:

http://silverlightukstorage.table.core.windows.net/Tables('Products')

To modify listing 1 to delete the Products table, you could replace the code at with the following:

HttpWebRequest hwr =
CreateHttpRequest(new Uri(@"http://silverlightukstorage.table.core.windows.net/Tables('Products')"), "DELETE", new TimeSpan(0, 0, 30));


As you can see, this code replaces the original GET request with a DELETE, and the URI has been modified. Because you no longer need to process an XML response, you’d also need to change the code at as follows:

hwr.GetResponse();

Finally, because the code now uses the live Table service rather than the development storage version, you’d also need to set the correct credentials.

You’ve now had a chance to interact with the Table service both via the StorageClient library and by using the REST API directly, so let’s look at some of the technologies used to implement the Table service REST API.

3. WCF Data Services and AtomPub

WCF Data Services (formerly known as Astoria) is a data-access framework that allows you to create and consume data via REST-based APIs from your existing data sources (such as SQL Server databases) using HTTP.

Rather than creating a whole new protocol for the Table service API, the Windows Azure team built the REST-based APIs using WCF Data Services. Although not all aspects of the Data Services framework have been implemented, the Table service supports a large subset of the framework.

One of the major advantages of WCF Data Services is that if you’re already familiar with the framework, getting started with the Windows Azure Table service is pretty easy. Even if you haven’t used the WCF Data Services previously, any knowledge gained from developing against Windows Azure storage will help you with future development that may use the framework.

WCF Data Services Client Libraries

WCF Data Services provides a set of standard client libraries that abstract away the complexities of the underlying REST APIs and allow you to interact with services in a standard fashion regardless of the underlying service. Whether you’re using WCF Data Services with the Windows Azure Table service or SQL Server, your client-side code will be pretty much the same.

AtomPub

The Windows Azure Table service uses the WCF Data Services implementation of the Atom Publishing Protocol (AtomPub) to interact with the Table service. AtomPub is an HTTP-based REST-like protocol that allows you to publish and edit resources. AtomPub is often used by blog services and content management systems to allow the editing of resources (articles and blog postings) by third-party clients. Windows Live Writer is a well-known example of a blog client that uses AtomPub to publish articles to various blog platforms (Blogspot, WordPress, Windows Live Spaces, and the like). In the case of Windows Azure storage accounts, tables and entities are all considered as resources.

Although WCF Data Services can support other serialization formats (such as JSON) the Table service implementation of WCF Data Services only supports AtomPub.

If you’re interested in reading more about the AtomPub protocol (RFC 5023) you can read the full specification here: http://bitworking.org/projects/atom/rfc5023.html.

Now that you have a basic awareness of AtomPub, we can look at how the AtomPub protocol and the Atom document format are used to create a table using the Table service REST API.

Other -----------------
- Doing CRUDy stuff with the Table service (part 3) - Deleting entities & Updating entities
- Doing CRUDy stuff with the Table service (part 2) - Adding entities & Listing entities
- Doing CRUDy stuff with the Table service (part 1) - Creating a context class
- Developing with the Table service
- Partitioning data across lots of servers : Partitioning the storage account & Partitioning tables
- Modifying an entity to work with the Table service
- How we’d normally represent entities outside of Azure
- A brief overview of the Table service
- BLOBs : Setting shared access permissions
- Enterprise Service Bus with BizTalk Server and Windows Azure : Distributed and Scalable ESB Architecture
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server