Showing posts with label vscode. Show all posts
Showing posts with label vscode. Show all posts

How I Learn APIs Quickly Using VS Code REST Client

When I stepped into a role with many APIs to ramp up on, I needed a faster way to explore endpoints, chain calls, and inspect responses without bouncing between tools.

The VS Code extension REST Client (humao.rest-client) helped me do exactly that. It lets you send REST and GraphQL requests directly from .http files in VS Code.

In this post, I will share the workflow I use to learn APIs quickly: keep requests close to code and notes, reuse values across calls, and avoid unnecessary copy-paste.

To start, create a .http file and add your requests there. Separate requests with ###; that separator is what makes the Send Request link appear above each request block.

Quick look at a page

Yes, you can use AI or tools like Postman and Insomnia to generate requests. But when your goal is to learn an API, it helps to keep everything close to your code and notes. I already had VS Code open all day, so I decided to keep my full API learning workflow there.

In my case, every API call is secured and requires an access token, so generating one is step zero. I could paste one token at the top of the file, but that approach breaks quickly: tokens expire, and pasted values can accidentally be committed or pushed.

That is why I keep credentials in a local .env file (for example: CLIENT_ID, CLIENT_SECRET, and TENANT_ID) that is listed in .gitignore.

Then I created my first request to generate an access token from those values:

POST https://login.microsoftonline.com:443/{{$dotenv TENANT_ID}}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

client_id={{$dotenv CLIENT_ID}}&scope={{$dotenv CREDS_SCOPES}}&client_secret={{$dotenv CLIENT_SECRET}}&grant_type=client_credentials

Quick breakdown: each {{$dotenv ...}} expression reads a value from your .env file, so you keep secrets out of your .http file and out of source control.

  • {{$dotenv TENANT_ID}} -> TENANT_ID
  • {{$dotenv CLIENT_ID}} -> CLIENT_ID
  • {{$dotenv CLIENT_SECRET}} -> CLIENT_SECRET

To execute the call, click the Send Request link above the request. The response opens in a new tab, and you can inspect the access token in the body.

Send Query button

Then you can use that token in the next request:

GET https://ecostruxure-building-platform-api-uat.se.app/api/Sites
Authorization: Bearer {{ACCESS_TOKEN}}
X-Api-Version: {{apiVersion}}

To avoid copy-pasting values, the better approach is to name requests and reference their responses as variables:

### ==============================
### Create Token
# @name createToken

POST https://login.microsoftonline.com:443/{{$dotenv TENANT_ID}}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

client_id={{$dotenv CLIENT_ID}}&scope={{$dotenv CREDS_SCOPES}}&client_secret={{$dotenv CLIENT_SECRET}}&grant_type=client_credentials

Notice the @name createToken labels that request. After it runs, you can access fields from its response body. The response content is JSON and looks like this:

{
  "token_type": "Bearer",
  "expires_in": 3599,
  "ext_expires_in": 3599,
  "access_token": "eyJ0..."
}

For example, to retrieve the access_token value, we can use the expression createToken.response.body.$.access_token. When assigned to a variable, it looks like this:

@ACCESS_TOKEN={{createToken.response.body.$.access_token}}

Then you can use {{ACCESS_TOKEN}} in all your requests, like this one that retrieves all buildings:

### ==============================
#### Retrieve my sites
# @name getBuildings

GET https://ecostruxure-building-platform-api-uat.se.app/api/Buildings
Authorization: Bearer {{ACCESS_TOKEN}}
X-Api-Version: {{apiVersion}}

If you come back later and the token has expired, just run the token request again, and the variable {{ACCESS_TOKEN}} will automatically update for all subsequent requests. No copy-pasting required.

Extracting a value from a list response

What if a response returns multiple items and you need one specific ID? For example, the previous query returns multiple buildings, but I was interested in the building named "Virtual Building FB". The response looks like this:

[
  {
    "organizationName": "BDP Team",
    "organizationId": "2dd6da1e",
    "siteId": "34580992",
    "floorCount": 1,
    "spaceCount": 2,
    "deviceCount": 0,
    "measurementCount": 0,
    "includesDeviceAndMeasurementCounts": false,
    "name": "Frank Demo Office",
    "referenceId": "frank-demo-building",
    "area": 0.0,
    "metadata": [],
    "id": "4a69071c"
  },
  {
    "organizationName": "BDP Team",
    "organizationId": "2dd6da1e",
    "siteId": "34580992",
    "floorCount": 2,
    "spaceCount": 5,
    "deviceCount": 0,
    "measurementCount": 0,
    "includesDeviceAndMeasurementCounts": false,
    "name": "Virtual Building FB",
    "referenceId": "vir-fb",
    "area": 0.0,
    "metadata": [
      {
        "name": "location",
        "value": "north wing"
      }
    ],
    "id": "01ab96fc"
  }
]

To get the value of the id property for one building with a specific name, we can filter with JSONPath:

@buildingId={{getBuildings.response.body.$[?(@.name=='Virtual Building FB')].id}}

This uses the previous request response (getBuildings) and extracts the matching id.

ℹ️ NOTE: If this is your first time seeing JSONPath, read it like this:

  • $ means "start from the root of the response body."
  • [?()] applies a filter.
  • @.name=='Virtual Building FB' keeps only objects where name matches.
  • .id returns the id field from the matched object.

Then use {{buildingId}} in the next request:

### ==============================
### Retrieve all floors within a specific building
# @name getFloors

GET https://ecostruxure-building-platform-api-uat.se.app/api/Buildings/{{buildingId}}/Floors
Authorization: Bearer {{ACCESS_TOKEN}}
X-Api-Version: {{apiVersion}}

Dynamic variables

Other built-in dynamic variables include:

  • {{$guid}}
  • {{$randomInt min max}}
  • {{$timestamp [offset option]}}
  • {{$datetime rfc1123|iso8601 [offset option]}}
  • {{$localDatetime rfc1123|iso8601 [offset option]}}
  • {{$processEnv [%]envVarName}}
  • {{$dotenv [%]variableName}}
  • {{$aadToken [new] [public|cn|de|us|ppe] [<domain|tenantId>] [aud:<domain|tenantId>]}}

For one historical-data query, I needed to pass a datetime in a very specific format. I solved that by generating the value with a dynamic variable:

@currentTimestamp={{$datetime 'YYYY-MM-DDTHH:mm:ss.SSS[000][Z]' -5 h}}

Then I passed {{currentTimestamp}} into the next request parameter.

Calling GraphQL from REST Client

Most examples above use GET requests, but you can also send POST requests and GraphQL queries.

For example, to get a building with its levels and rooms:

### GRAPH: buildings & equipment
POST https://ecostruxure-building-platform-api-uat.se.app/graphql
Content-Type: application/json
Authorization: {{ACCESS_TOKEN}}
X-REQUEST-TYPE: GraphQL
X-Api-Version: {{apiVersion}}

query MyQuery {
  buildings(where: {name: {eq: "Frank Demo Office"}}) {
    id
    name
    levels {
      name
      rooms {
        name
      }
    }
  }
}

Here we use POST because the GraphQL query is sent in the request body.

The response looks like:

{
  "data": {
    "buildings": [
      {
        "id": "4a69071c",
        "name": "Frank Demo Office",
        "levels": [
          {
            "name": "Ground Floor",
            "rooms": [
              {
                "name": "Open Office Space"
              },
              {
                "name": "Terrasse"
              }
            ]
          }
        ]
      }
    ]
  }
}

GraphQL is powerful here because you can request related data in one call instead of chaining multiple REST endpoints.

In short: if you are learning a new API, REST Client helps you move faster with less context switching. Keep your requests in a .http file, reuse values with @name + {{...}}, and iterate directly in VS Code.

Lately, this workflow has been even more useful as my day-to-day work includes broader platform discussions and faster discovery cycles.

If useful, I can share a follow-up .http starter template that you can adapt to your own APIs.

Show Me

You prefer watching a video? I got you here a video I did sharing the how I use REST Client extension.

Useful references:

Reading Notes #713

This week’s collection explores the practical side of AI, focusing on governance in multi-model environments and the security advantages of robust sandboxing. I’ve also included some foundational perspectives on and organizational goals, along with a look into the history of one of my favorite tools, VS Code.

AI

Programming

by John Doerr 

That book has been on my to-read list for a very long time. As someone who worked at Microsoft using many OKRs, I was comfortable with the topic. Nevertheless, it was interesting to learn how other people use it in many different contexts.







Reading Notes #705

This week’s collection features a mix of critical .NET lifecycle updates and practical strategies for optimizing your database interactions. These selected articles offer helpful insights into everything from edge computing deployments to the evolving landscape of AI in modern workflows.


AI

  • AI Raised the Bar (And Now We're All Tired) (Golnaz) - It's so true! So much can be done quickly today. An interesting question is: how do we avoid burning out resources and tokens? How, as human we stay smart? After all, life is a marathon, not a sprint!

Cloud

Databases

DevOps

Programming

Miscellaneous

~frank


Reading Notes #696

This week's collection highlights the rapid evolution of AI agents, exploring their asynchronous capabilities, deployment journeys, and their impact on DevOps and video editing. On the programming front, we explore new Git features and API versioning with OpenAPI in .NET 10. We also dive into some fascinating podcast discussions ranging from the GUI vs. CLI debate to generational perspectives in the workplace. 
Enjoy the reading!

AI

Programming

Podcast


~frank

Reading Notes #690

AI keeps changing how we build, think, and even feel about software. This batch of posts & episodes mixes practical agent skills, vibe coding, and faster shipping with a bit of reflection on the old internet and why it still sticks with us.


AI


Podcasts

  • Your Images are Out of Date (probably) - The Silent Rebuilds problem (DevOps and Docker Talk: Cloud Native Interviews and Tooling) - Very interesting episode. I guess I never realized how true it is that as soon as you download your image, they are outdated. This episode talks about the concept of silent rebuilds and tools to help us solve that issue.

  • 503: Welcome to Tiny Tool Town (Merge Conflict) - With a name like Tiny Tool Town, my head always goes to Looney Tunes. No idea why, but this episode is not about that. It's about the collection of open source tools named: Tiny Tool Town, and they also talk about different models in GitHub Copilot.

  • Building Software using Squad with Brady Gaster (.NET Rocks!) - Turn your Coplot to 11 with Squad. Carl and Richard talk to Brady Gaster about Squad, a tool for creating an AI development team using GitHub Copilot.

  • Daniel Ward: AI Agents - Episode 393 (Azure & DevOps Podcast) - In this episode, they talk about the different AI tools used by developers and DevOps people, and the trends.

  • Everything Is a Graph (Even Your Dad Jokes) with Roi Lipman (Screaming in the Cloud) - Nice episode about different database and most obviously about graph databases. Very interesting to learn more about all that explosion of database types.


Miscellaneous


Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, podcasts and books that catch my interest during the week.

If you have interesting content, share it!

~frank


Reading Notes #671

From debugging Docker builds to refining your .NET setup, this week’s Reading Notes delivers a sharp mix of practical dev tips and forward-looking tech insights. We revisit jQuery’s place in today’s web stack, explore AI-enhancing MCP servers, and spotlight open-source projects shaping tomorrow’s tools. Plus, PowerToys gets a sleek upgrade to streamline your Windows workflow. 

Let’s check out the ideas and updates that keep your skills fresh and your systems humming.

Programming

AI

Miscellaneous

Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week.

If you have interesting content, share it!

~frank

Reading Notes #659

This week's reading notes cover a variety of insightful topics, from enhancing your development environment with dev containers on Windows to prioritizing open-source bugs effectively. You'll also find helpful posts on integrating MFA into your login process, exploring RavenDB's vector search capabilities, and understanding the differences between Ask Mode and Agent Mode in Visual Studio.

Happy reading!

a wild turkey in my driveway
A wild turkey in my driveway!?

Suggestion of the week


Databases


Programming

  • Why You Should Incorporate MFA into Your Login Process (Suzanne Scacca) - You think the answer is simple, think again. Nice post that explains the difference between 2FA and MFA and why you should or should not implement one of those

  • Aspire Dashboard (Joseph Guadagno) - Great deep dive about the Aspire dashboard, learn all the features packed inside it


Open Source

  • How I Prioritize OSS Bugs (jeremydmiller) - A very instructive post on a real-life issue. It's harder than people think to prioritize. And it may help you write better bug reports...

AI


Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it! 

~frank

Reading Notes #657

a rocky path ends at the shore of a lake
This week's collection of interesting articles and resources covers AI development, DevOps practices, and open source tools. From GitHub Copilot customization to local AI deployments and containerization best practices, here are the highlights worth your attention.

AI

DevOps

  • Local Deploy with Bicep (Sam Cogan) - A perfect short story, I'll explain why the hell bicep can now deploy locally and how to do it

Open Source

  • Introducing OpenCLI (Patrik Svensson) - A standard that describes CLI so both humans and agents can understand how it works. Love it!

~frank


Reading Notes #654

Welcome to another edition of my reading notes! This week, I’ve gathered a selection of insightful articles and resources covering topics like AI, cloud security, open source, and developer productivity. Whether you’re interested in best practices, new tools, or thought-provoking perspectives, there’s something here for everyone. 

Dive in and enjoy the highlights!

Suggestion of the week

  • Copilot, The Good Parts: Efficiency (Rob Conery) - I love that post, it's so true! There are good and bad ways to use any tools. And I personally would really like seeing Rob build his stuff. Let's him know If you think like me.

Programming

Open Source

Databases

Miscellaneous


~frank


Reading Notes #653

Welcome to Reading Notes #653 another packed edition of insights, tools, and updates from the tech world! This week's roundup dives into legendary engineering wisdom, AI controversies, and the latest innovations in Docker, Azure, and VS Code. Whether you're exploring MCP, refining your scripting skills, or gearing up for the newest Azure Developer CLI release, there's something here for every developer.

windmill on the cap of Ile Perrot

Let’s get into it!

Cloud

  • Azure Developer CLI (azd) - June 2025 (Kristen Womack) - Love that tool, great updates, so many new features and improvements in this version, very looking forward to try all of them, turning them all

AI

Programming

Miscellaneous


~frank

Reading Notes #651

Welcome to another edition of my reading notes! This week brings some fascinating insights into AI's real-world impact, exciting developments in .NET and containerization, plus practical tools for improving our development workflows. 
A duck in a city fontain

From local AI-powered code reviews to Docker security hardening and the upcoming .NET 10 features, there's plenty to explore.

 

AI

Programming

Cloud

Miscellaneous

  • Enhance productivity with AI + Remote Dev (Brigit Murtaugh, Christof Marti, Josh Spicer, Olivia Guzzardo McVicker) - I love the dev container environments, they are so useful! And I also use the remote one when I'm not on my dev device so easy. Happy to see that Copilot will be right there with me.
~frank

Reading Notes #650

It's time for another edition of Reading Notes! This week brings exciting developments in the open source world, with major announcements from Microsoft making WSL and VS Code's AI features open source. We've also got updates on Azure Container Apps, .NET Aspire, and some great insights on developer productivity tools.
 
Let's dive into these interesting reads that caught my attention this week.

Cloud

Programming

Open Source

AI

  • Agent mode for every developer (Katie Savage) - Great new for everyone as the agent mode become available in so many different editor. This post also contains videos to shows some scenarios.

Podcasts

Miscellaneous

  • The experience is enough (Salma Alam-Naylor) - Whether we like it or not, we are people creature. We all need to stop hiding behind our screens and get out there!

~frank

Reading Notes #647


This post is a collection of my latest reading notes, highlighting interesting articles and resources on AI, programming, databases, and more. Each link includes a brief summary of what I found valuable or noteworthy.
screenshot linux shutdown operations

AI


Programming


Databases


Miscellaneous

  • Help yourself to thrive (Salma) - The human body is an extraordinary machine, extremely strong and conciliant, but it also requires a fine turning. Great post, we must learn from it.


Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it!

~Frank

Reading Notes #646

Welcome to this week's collection of fascinating reads across cloud computing, AI, and programming! As technology continues to evolve at breakneck speed, I've gathered some of the most insightful articles that caught my attention. From securing MCP servers to exploring Rust, there's something here for every tech enthusiast. 
Dive in and discover what's new in our rapidly changing digital landscape.

Cloud

AI

Programming

Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it!

~Frank

Reading Notes #644

This post gathers my recent reading notes on artificial intelligence, programming, and a few inspiring podcasts. It includes links to articles, tutorials, and fascinating discussions. Whether you're interested in the latest AI developments, .NET tools, or modern architectures, there's plenty here to spark your curiosity. 


Happy reading!

AI


Programming


Podcasts

Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it!

~Frank

Reading Notes #642

This week, I explored posts about improving cache management for ASP.NET Core applications and understanding error handling in Blazor. These articles, along with others on AI model selection and development productivity, offer valuable insights for developers.


Cloud


Programming


AI


Miscellaneous



Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 


If you have interesting content, share it!

~Frank

Reading Notes #641

This week's reading notes cover an array of topics, from programming insights and AI advancements to cloud solutions and practical tips for developers. Explore the updates, tools, and advice that could inspire your next project!
web dev in a D&D monsters card style
prompt: Web dev in a D&D monsters card style


 

Suggestion of the week


Cloud


Programming


AI


Miscellaneous


Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 


If you have interesting content, share it!

~Frank

Reading Notes #640

Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it! 

Cloud


AI


Programming

~frank

Reading Notes #638

Welcome to Reading Notes —a curated dive into the latest and greatest in programming, cloud, and AI. From mastering multithreading with Azure to exploring GitHub Copilot's productivity potential, this collection is brimming with knowledge. Let's unravel what's new, innovative, and worth your attention!


Cloud


Programming

AI

Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. 

If you have interesting content, share it! 

~frank


Reading Notes #637

In this edition of my Reading Notes, I've curated some fascinating content that spans across programming, creativity, and enlightening podcasts. Whether you're eager to enhance your coding skills, explore unique ideas, or stay updated with the latest in the tech world, there's something here for everyone. 
Dive in and enjoy these insightful reads and discussions!

Programming

Podcasts

Miscellaneous



Sharing my Reading Notes is a habit I started a long time ago, where I share a list of all the articles, blog posts, and books that catch my interest during the week. If you have interesting content, share it! 

 ~Frank