Tag: DAB

  • Day of Data Baton Rouge Slides and Code

    Thanks to everyone for attending my talk today at Day of data Baton Rouge 2026 (formerly SQL Saturday Baton Rouge).

    The slides are here: Building an API with DAB – Baton Rouge

    The repo for the code and demos is here: DAB-Experiments

    Use the Getting Started folder for the setup and demos as batch files. This is for SQL Server with a user set as JoeUser. Change this in the .env file if you want to alter this. I use Northwind, with a few additions in the .sql files.

    Apologies, it’s not completely organized as I am still working on the flow and structure. feel free to reach out with questions.

  • The Data API Builder Start and Add Extensions in VS Code

    One of the things that I like about the Data API Builder (DAB) is that there is a lot of CLI work that can be done. However, lots of people don’t like these, so I’m glad there’s a series of extensions in the Visual Studio Code (VSCode) marketplace that you can use.

    This post looks at the start and add extensions. Another post will look at the others.

    Update: All these are now in one extension.

    This is part of a series of posts on DAB that I’ve written. I also have articles at SQL Server Central about DAB.

    Installing the Extensions

    In VSCode, you can search for DAB in the extensions blade. You should see these, but there could be more by the time you read this.

    2024-12_0249

    I clicked install on these and they were added to my VS Code. Now let’s play with them. Each of them adds a right click menu item to the dab-config.json file.

    DAB Start

    The first one I tried was start. Since I had a valid dab-config.json in my file list, I could right click it. I see DAB Start as an option and select it.

    2024-12_0266

    This opens a new terminal. You need to be aware of this, as on the right side of your terminal, there is a new column and each terminal session is listed. The lower one is highlighted, opened by the DAB Start extension. You can see the output on the left, which is running.

    2024-12_0267

    I could then interact with my APIs in the browser. When I wanted to stop this, I could CTRL+C in the left terminal section, as in any, but I’d still have this terminal extension. The next time I clicked DAB Start, another new session would start.

    Instead, I clicked the “Delete” trashcan next to the terminal on the left to stop this session and the DAB service.

    2024-12_0265

    DAB ADD

    The ADD extension lets you add entites as well. If I right click and select DAB Add, I get another menu of types.

    2024-12_0259

    Once I select one, I see a list of objects from the database that I can view. In this case, the connection used in my DAB config file only sees three tables, so I can choose one of these.

    2024-12_0260

    If I hit Enter, I get a message that this was added.

    2024-12_0261

    If I look in the JSON for the config, I see that this is indeed added. This is another entity in my list, with the graphql and REST endpoints enabled.

    2024-12_0262

    Summary

    This post looked at these simple extensions, which leverage VSCode to make working with the DAB easier. If you’re experimenting with DAB, try these extensions. I certainly find them easier ways to work with my config file than editing things directly or trying to copy/paste.

     

  • Removing the REST Endpoint in the Data API Builder

    The more I work with the Data API Builder (DAB), the more I lean towards GraphQL instead of REST. Rest isn’t bad, but it’s tough.

    This is part of a series of posts on DAB that I’ve written. I also have articles at SQL Server Central about DAB.

    Checking the Endpoint

    In my first article and DAB, I set up things with defaults and exposed a table. As you can see, my REST endpoint is live and running.

    2024-12_0250

    I can also see this in Postman.

    2024-12_0251

    Wht if I want to remove this and only look at GraphQL? Let’s see what I need to do.

    Removing the REST Runtime

    In the config file, there is this section for the REST configuration at runtime.

    2024-12_0252

    I can remove this, but I’d hope I didn’t mess up the JSON. This is hard to read. Certainly this is something I can delete, but is there another way?

    There is. In the DAB CLI  reference, one of the parameters is –rest.disabled. Let’s try that.

    2024-12_0254

    That doesn’t work. Hmmm, OK, let’s add the database type

    2024-12_0255

    Apparently init only creates new files.

    There is an update verb, but that doesn’t work either.

    2024-12_0253

    I guess I’m editing the file. I remove the highlighted section above and the API starts.

    2024-12_0256

    Let’s check the REST endpoint. It appears to still work:

    2024-12_0257

    In the runtime, I see this log:

    2024-12_0258

    Weird. I see an error, but data is returned.

    Looking down, I see this in my config for an entity. The REST is enabled.

    2024-12_0263

    I’ll change that to false and restart the DAB service. Now I see this. REST is still there, but this path is broken.

    2024-12_0264

    If I go to the root for /api, I get a 404. There’s still a response, as there is a service here running GraphQL, but the REST path for /api is gone.

    2024-12_0264

    Summary

    I’m not sure this really works, as if I enable this for any entity, then the REST call works. If I add any entity without using the –rest: false parameter, the REST path is added by default, so my guess is this is likely to be randomly added back by developers if they don’t have a wrapper around the CLI that ensures no REST paths are enabled.

  • Playing with the Data API Builder

    I published an article today on the Data API Builder, which is a way of presenting your database tables as a REST or GraphQL API for developers. You can read the article to learn how to get started, but I’m adding a small thing in this post.

    This is part of my posts on the Data API Builder.

    Setting the Page

    The default page for data is 100 elements (and the next URL). That’s a lot for display, and I might not want developers to get that much data by default. Perhaps I only want 5 rows.

    In the JSON file, I’ll add an item below the development mode element (but a level above. I’ve shown this below:

    2024-12_0164

    The JSON is a bit fiddly, so you need to make sure you know where you’re adding this. The options are below the “runtime” at the same level as “rest” and other items.

    Once I do this, if I query from Postman, I see this, only 5 elements (and the next)

    2024-12_0165

    A quick add, which will be in the next (or next after that) DAB article.