Did you know that Dataverse has a OpenApi (Swagger) endpoint? You can use this endpoint for generating clients that talk to Dataverse. Tables and custom apis/custom actions are included.
Just browse to ‘[DataverseOrgUrl]/api/flow/openapi’ to see it. This will output a JSON string with a OpenApi/Swagger definition, version 2.0 (at the time of writing).
You can use this file to generate clients for any programming language. One such generator is Kiota by Microsoft https://learn.microsoft.com/en-us/openapi/kiota/overview
I found the existence of this endpoint through the Dataverse application insights integration. If you are in Power Automate, and search for unbound actions for example, you will see references to this url in the Application Insights logs.
Is it possible to load that json into swagger ui somehow?
Yes, should be possible. You need to add an Authorization header though. Alternatively, you can copy a snapshot to a json file and work with that or serve it through an api.
It would be nice to see how you embedd this JSON to that thing Kiota or Swagger UI 🙂 I would really appreciate it.
It’s quite easy: first, copy and paste the contents from the endpoint and save it in a .json file. Then download the Kiota extension in VSCode. In the top search bar, go to ‘Show and Run Commands’. Use ‘Kiota: Open API description’. Enter the path to the file. The Kiota OpenApi Explorer should open. Click the ‘Run’ button (the play button) to generate a client for your programming language.
doesnt seem to expose any of the core entities…am i missing something?
True, some stuff is exposed through this endpoint and some stuff isn’t. You can query the separate tables like so: ‘[DataverseOrgUrl]/api/flow/v1.0/$metadata.json/entities/accounts’