CRUD Operations with SDKs and REST APIs
1. CRUD Operations with SDKs and REST APIs
Welcome back! In this video, we'll explore how developers interact with Azure Storage programmatically, using SDKs and REST APIs.2. CRUD
CRUD operations are: Create, Read, Update, and Delete. These are the building blocks for working with any Azure Storage service: Blobs, Tables, Queues, and Files.3. CRUD
Think of CRUD as the basic vocabulary for talking to your data. Once you master it, you can build anything, from simple uploads to global data pipelines.4. SDKs vs REST APIs
Azure provides two main ways to work with storage programmatically: SDKs and REST APIs. SDKs, which stands for Software Development Kits, are language-specific libraries, available for .NET, Python, Java, Node.js, and more. Better suited for large applications requiring a specific language. They simplify authentication and requests, and handle API version changes automatically so your code stays compatible when Azure updates its services. REST APIs also known as RESTful Application Programming Interface, use standard HTTP calls, like PUT, GET, PATCH, and DELETE, giving you full control at the protocol level, great for lightweight work. REST calls require manual construction of headers, authentication tokens, and retries. If SDKs are a friendly barista taking your order, REST APIs are like you making the espresso manually—more control, more work.5. 3 ways to authenticate
Before performing CRUD operations, your code must authenticate. You can use: A connection string containing the account key is best for local dev. A Shared Access Signature (SAS) for time-limited access. Or a Managed Identity with Azure AD tokens for production apps. Cipher Coffee’s production systems use managed identities so no keys are stored in code.6. Creating using Python SDK
Here's a Create example using the Python SDK. Cipher Coffee's ordering system stores receipts when customers complete purchases. The code creates a BlobServiceClient, references the "order-receipts" container, and calls upload_blob with the receipt data. With just a few lines, you've uploaded a file to Blob Storage.7. REST APIs in action
For environments without SDK support, use REST APIs directly. Cipher Coffee's point-of-sale terminals run lightweight firmware, so they make direct HTTP calls instead. A PUT request uploads a receipt. A GET request retrieves it. A DELETE request removes it. Headers include the blob type, API version, and authorization token. This gives you full flexibility, perfect for embedded systems or third-party integrations.8. Why CRUD matters
As a developer, you're working on systems that frequently need to store, retrieve, and modify data dynamically. Whether you're uploading customer photos, updating order statuses, or deleting temporary files, Azure's SDKs and REST APIs make it all possible, securely and efficiently. Cipher Coffee's ordering app uses CRUD operations daily, storing order receipts as blobs, retrieving promotional images for the website, and removing outdated marketing files and lifecycle policies.9. When to use SDKs
Use SDKs when building full applications, when you need automatic retries, or when working with complex operations like chunked uploads.10. Error handling and best practices
When performing CRUD operations, always handle errors gracefully. Use try-except blocks in SDKs or check HTTP status codes in REST responses. Best practices: Batch operations to minimize network calls. Use async methods for throughput. Retry on transient throttling failures (HTTP 429) or service unavailable errors (503). Log x-ms-request-id for debugging. Think of it like a coffee machine: sometimes pressure fluctuates, you don't rebuild the shop; you retry the shot.11. Azure API management
If you'd like to go into further detail regarding APIs, we'd recommend checking out Azure API management, available here at DataCamp!12. Let's practice!
Ready to go beyond just storing data and start managing it? Let’s get hands-on with SDKs and REST APIs to power Cipher Coffee’s operations!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.