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.

Unknown's avatar

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.

2 Responses to Removing the REST Endpoint in the Data API Builder

  1. John VanDamme's avatar John VanDamme says:

    The CLI init options says (last updated on 1/25/2025):
    –rest.enabled ❌ No true ✔️ Yes boolean Enables REST endpoint for all entities.

    Haven’t tried to change the signature and run it.

    Like

    • way0utwest's avatar way0utwest says:

      Thanks, I hope that works, but haven’t tested it. I have found a few things that don’t let me modify a setup easily, so I decided to play with the config file directly. I’ll have to try that.

      Like

Comments are closed.